Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.016 s | 3 KBi |
#2 |
Incorrecto
|
0.016 s | 7 KBi |
#3 |
Incorrecto
|
0.011 s | 3 KBi |
#4 |
Incorrecto
|
0.014 s | 3 KBi |
#5 |
Correcto
|
0.012 s | 3 KBi |
#6 |
Correcto
|
0.009 s | 3 KBi |
#7 |
Incorrecto
|
0.059 s | 11 KBi |
#8 |
Incorrecto
|
0.058 s | 11 KBi |
#9 |
Incorrecto
|
0.047 s | 11 KBi |
#10 |
Incorrecto
|
0.088 s | 11 KBi |
#11 |
Incorrecto
|
0.065 s | 11 KBi |
#12 |
Incorrecto
|
0.055 s | 11 KBi |
#13 |
Correcto
|
0.079 s | 11 KBi |
#14 |
Incorrecto
|
0.079 s | 11 KBi |
#15 |
Correcto
|
0.098 s | 11 KBi |
#16 |
Correcto
|
0.066 s | 8 KBi |
#17 |
Incorrecto
|
0.053 s | 8 KBi |
#18 |
Incorrecto
|
0.062 s | 5 KBi |
#19 |
Correcto
|
0.059 s | 5 KBi |
#20 |
Correcto
|
0.054 s | 5 KBi |
#21 |
Incorrecto
|
0.08 s | 5 KBi |
#22 |
Incorrecto
|
0.053 s | 6 KBi |
from sys import stdin def prefix(p): m = len(p) pi = [0 for _ in range(m)] j = 0 for i in range(1, m): while j > 0 and p[i] != p[j]: j = pi[j - 1] if p[i] == p[j]: j += 1 pi[i] = j return pi def border(l2r, r2l): res = 0 for s, e in zip(l2r, r2l): if s == e: res = max(res, s) return res for line in stdin: p = list(line[:-1]) l2r = prefix(p) p.reverse() r2l = prefix(p) r2l.reverse() #print(f"s={p}") #print(f"l2r={l2r}") #print(f"r2l={r2l}") print(border(l2r, r2l))