Skip to content

Commit

Permalink
Merge pull request #255 from AlgoLeadMe/81-tgyuuAn
Browse files Browse the repository at this point in the history
81-tgyuuAn
  • Loading branch information
tgyuuAn authored Dec 1, 2024
2 parents d494d98 + a22fd08 commit c15a112
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions tgyuuAn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@
| 78์ฐจ์‹œ | 2024.10.06 | ๊ทธ๋ฆฌ๋”” | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/68646">ํ’์„  ํ„ฐ๋œจ๋ฆฌ๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/250
| 79์ฐจ์‹œ | 2024.10.12 | ์ด๋ถ„ ๋งค์นญ | <a href="https://www.acmicpc.net/problem/9576">์ฑ… ๋‚˜๋ˆ ์ฃผ๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/251
| 80์ฐจ์‹œ | 2024.11.11 | ๋‹ค์ต์ŠคํŠธ๋ผ | <a href="https://www.acmicpc.net/problem/11779">์ตœ์†Œ๋น„์šฉ ๊ตฌํ•˜๊ธฐ 2</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/254
| 81์ฐจ์‹œ | 2024.11.15 | ์ด๋ถ„ ํƒ์ƒ‰ | <a href="https://www.acmicpc.net/problem/1701">Cubeeditor</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/255
---
28 changes: 28 additions & 0 deletions tgyuuAn/์ด๋ถ„ ํƒ์ƒ‰/Cubeeditor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from collections import defaultdict
import sys

def input(): return sys.stdin.readline().rstrip()

_input = input()

def check(string, mid):
temp = defaultdict(int)
for start_idx in range(len(string)-mid+1):
now = string[start_idx:start_idx+mid]
temp[now] += 1
if temp[now] >=2 : return True
return False

answer = 0
left = 0
right = len(_input)
while left+1 < right:
mid = (left+right)//2

# ๋งŒ์•ฝ ํ•ด๋‹น ๋ฒ„ํผ ํฌ๊ธฐ์— ๋‹ต์ด ์žˆ๋‹ค๋ฉด
if check(_input, mid):
answer = mid
left = mid
else: right = mid

print(answer)

0 comments on commit c15a112

Please sign in to comment.