#include<bits/stdc++.h>
#define N 300100
using namespace std;
long long S[N],ans,c,m;
struct T {
long long t[N][26],li[N],len[N],oc[N],sz,lst;
T(){sz=li[0]=li[1]=1;len[1]=-1;}
void add(int c) {
int p = lst;S[++m]=c;
while (S[m-1-len[p]]-c)p=li[p];
if (!t[p][c]) {
int q=li[p];
while(S[m-len[q]-1]-c)q=li[q];
li[++sz]=t[q][c];
len[t[p][c]=sz]=len[p]+2;
}
oc[lst=t[p][c]]++;
}
} X;
int main() {
memset(S,1,sizeof S);
c=getchar();
while(c!='\n') X.add(c-'a'),c=getchar();
for(int x=X.sz;~x;x--)
X.oc[X.li[x]]+=X.oc[x];
for(int x=X.sz;~x;x--)
ans=max(ans,X.len[x]*X.oc[x]);
cout<<ans<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
9048 KB |
Output is correct |
2 |
Correct |
1 ms |
9052 KB |
Output is correct |
3 |
Correct |
1 ms |
9052 KB |
Output is correct |
4 |
Correct |
1 ms |
9052 KB |
Output is correct |
5 |
Correct |
1 ms |
9052 KB |
Output is correct |
6 |
Correct |
1 ms |
9052 KB |
Output is correct |
7 |
Correct |
1 ms |
9052 KB |
Output is correct |
8 |
Correct |
2 ms |
9052 KB |
Output is correct |
9 |
Correct |
1 ms |
9052 KB |
Output is correct |
10 |
Correct |
2 ms |
9052 KB |
Output is correct |
11 |
Correct |
1 ms |
9052 KB |
Output is correct |
12 |
Correct |
1 ms |
9052 KB |
Output is correct |
13 |
Correct |
1 ms |
9048 KB |
Output is correct |
14 |
Correct |
1 ms |
9052 KB |
Output is correct |
15 |
Correct |
1 ms |
9052 KB |
Output is correct |
16 |
Correct |
2 ms |
9052 KB |
Output is correct |
17 |
Correct |
1 ms |
9052 KB |
Output is correct |
18 |
Correct |
1 ms |
9052 KB |
Output is correct |
19 |
Correct |
1 ms |
9052 KB |
Output is correct |
20 |
Correct |
1 ms |
9052 KB |
Output is correct |
21 |
Correct |
1 ms |
9052 KB |
Output is correct |
22 |
Correct |
1 ms |
9052 KB |
Output is correct |
23 |
Correct |
1 ms |
9052 KB |
Output is correct |
24 |
Correct |
2 ms |
9052 KB |
Output is correct |
25 |
Correct |
1 ms |
9052 KB |
Output is correct |
26 |
Correct |
1 ms |
9048 KB |
Output is correct |
27 |
Correct |
1 ms |
9052 KB |
Output is correct |
28 |
Correct |
2 ms |
9052 KB |
Output is correct |
29 |
Correct |
2 ms |
9048 KB |
Output is correct |
30 |
Correct |
1 ms |
9052 KB |
Output is correct |
31 |
Correct |
1 ms |
9052 KB |
Output is correct |
32 |
Correct |
1 ms |
9052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
9308 KB |
Output is correct |
2 |
Correct |
2 ms |
9308 KB |
Output is correct |
3 |
Correct |
1 ms |
9308 KB |
Output is correct |
4 |
Correct |
2 ms |
9560 KB |
Output is correct |
5 |
Correct |
2 ms |
9308 KB |
Output is correct |
6 |
Correct |
2 ms |
9304 KB |
Output is correct |
7 |
Correct |
1 ms |
9308 KB |
Output is correct |
8 |
Correct |
1 ms |
9308 KB |
Output is correct |
9 |
Correct |
2 ms |
9308 KB |
Output is correct |
10 |
Correct |
1 ms |
9052 KB |
Output is correct |
11 |
Correct |
1 ms |
9052 KB |
Output is correct |
12 |
Correct |
1 ms |
9308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
13148 KB |
Output is correct |
2 |
Correct |
3 ms |
13404 KB |
Output is correct |
3 |
Correct |
2 ms |
13148 KB |
Output is correct |
4 |
Correct |
3 ms |
13336 KB |
Output is correct |
5 |
Correct |
2 ms |
13148 KB |
Output is correct |
6 |
Correct |
2 ms |
13148 KB |
Output is correct |
7 |
Correct |
3 ms |
13148 KB |
Output is correct |
8 |
Correct |
2 ms |
9052 KB |
Output is correct |
9 |
Correct |
1 ms |
9052 KB |
Output is correct |
10 |
Correct |
2 ms |
10332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
31324 KB |
Output is correct |
2 |
Correct |
10 ms |
31324 KB |
Output is correct |
3 |
Correct |
10 ms |
31516 KB |
Output is correct |
4 |
Correct |
10 ms |
31440 KB |
Output is correct |
5 |
Correct |
12 ms |
31324 KB |
Output is correct |
6 |
Correct |
10 ms |
25948 KB |
Output is correct |
7 |
Correct |
10 ms |
28252 KB |
Output is correct |
8 |
Correct |
3 ms |
9308 KB |
Output is correct |
9 |
Correct |
5 ms |
15960 KB |
Output is correct |
10 |
Correct |
11 ms |
28252 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
70748 KB |
Output is correct |
2 |
Correct |
28 ms |
70752 KB |
Output is correct |
3 |
Correct |
27 ms |
70744 KB |
Output is correct |
4 |
Correct |
29 ms |
70748 KB |
Output is correct |
5 |
Correct |
39 ms |
70876 KB |
Output is correct |
6 |
Correct |
25 ms |
65372 KB |
Output is correct |
7 |
Correct |
26 ms |
61780 KB |
Output is correct |
8 |
Correct |
5 ms |
9308 KB |
Output is correct |
9 |
Correct |
5 ms |
9380 KB |
Output is correct |
10 |
Correct |
30 ms |
61016 KB |
Output is correct |
11 |
Correct |
26 ms |
70744 KB |
Output is correct |
12 |
Correct |
7 ms |
16988 KB |
Output is correct |