Submission #860757

#TimeUsernameProblemLanguageResultExecution timeMemory
860757EllinorThree Friends (BOI14_friends)Cpython 3
0 / 100
376 ms9984 KiB
N = int(input()) n = N // 2 s = input() if not N % 2: print("NOT POSSIBLE") exit(0) ans = [] if s[1:n+1] == s[n+1:N]: ans.append(s[1:n+1]) if s[0] == s[n]: p = 0 ss = s[0] for i in range(1,n): if not s[i] == s[n + i + p]: if p == 0: p = 1 i -= 1 else: p = 2 break if p < 2: ans.append(s[0:n]) if s[0] == s[n + 1]: p = 0 ss = s[n + 1] for i in range(1,n): if not s[i + p] == s[n + 1 + i]: if p == 0: p = 1 i -= 1 else: p = 2 break if p < 2: ans.append(s[n+1:N]) if len(ans) > 1: print("NOT UNIQUE") elif len(ans) == 1: print(ans[0]) else: print("NOT POSSIBLE")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...