Submit Info #2671

Problem Lang User Status Time Memory
Z Algorithm pypy3 renoyu WA 260 ms 148.29 MiB

ケース詳細
Name Status Time Memory
example_00 WA 64 ms 31.97 MiB
example_01 WA 65 ms 31.97 MiB
example_02 WA 65 ms 31.88 MiB
example_03 WA 65 ms 31.96 MiB
random_00 WA 245 ms 126.02 MiB
random_01 WA 260 ms 148.29 MiB
random_02 WA 90 ms 43.42 MiB
random_03 WA 245 ms 136.25 MiB
random_04 WA 175 ms 92.94 MiB
random_05 WA 184 ms 100.50 MiB
random_06 WA 256 ms 145.87 MiB
random_07 WA 109 ms 59.95 MiB
random_08 WA 174 ms 94.61 MiB
random_09 WA 111 ms 57.39 MiB

import sys,collections as cl,bisect as bs sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] aa = x[0] su = 1 for i in range(len(x)-1): if aa != x[i+1]: a.append([aa,su]) aa = x[i+1] su = 1 else: su += 1 a.append([aa,su]) return a def jo(x): #listをスペースごとに分ける return " ".join(map(str,x)) def max2(x): #他のときもどうように作成可能 return max(map(max,x)) def In(x,a): #aがリスト(sorted) k = bs.bisect_left(a,x) if k != len(a) and a[k] == x: return True else: return False """ def nibu(x,n,r): ll = 0 rr = r while True: mid = (ll+rr)//2 if rr == mid: return ll if (ここに評価入れる): rr = mid else: ll = mid+1 """ a = list(input())[:-1] print(a) ppp = [0 for i in range(len(a))] ppp[0] = len(a) i = 1 j = 0 while i < len(a): while i+j < len(a) and a[j] == a[i+j]: j += 1 ppp[i] = j if j == 0: i+=1 continue k = 1 while i+k < len(a) and k + ppp[k] < j: ppp[i+k] = ppp[k] k += 1 i += k j -= k print(jo(ppp))