#include<bits/stdc++.h>
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define R return
#define F first
#define S second
#define C continue
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int MX=1009;
const ll mod=1e9+7;
const ll inf=(1ll<<60);
ll n;
string s;
map<string,pll>m;
int main(){
cin>>s;
n=s.size();
for(int i=0;i<n;i++){
string tmp="";
for(int j=i;j<n;j++){
tmp+=s[j];
m[tmp].F=i;
m[tmp].S++;
}
}
ll ans=0;
for(auto pp:m){
string x=pp.F;
ll i=pp.S.F,b=0;
ll k=pp.S.S;
ll y=x.size();
for(int i=0;i<y/2;i++){
if(x[i]!=x[y-i-1])b=1;
}
if(!b)ans=max(ans,y*k);
}
cout<<ans<<endl;
}
Compilation message
palindrome.cpp: In function 'int main()':
palindrome.cpp:32:12: warning: unused variable 'i' [-Wunused-variable]
ll i=pp.S.F,b=0;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2024 KB |
Output is correct |
2 |
Correct |
0 ms |
2024 KB |
Output is correct |
3 |
Correct |
0 ms |
2024 KB |
Output is correct |
4 |
Correct |
0 ms |
2024 KB |
Output is correct |
5 |
Correct |
0 ms |
2024 KB |
Output is correct |
6 |
Correct |
0 ms |
2024 KB |
Output is correct |
7 |
Correct |
0 ms |
2024 KB |
Output is correct |
8 |
Correct |
0 ms |
2024 KB |
Output is correct |
9 |
Correct |
0 ms |
2024 KB |
Output is correct |
10 |
Correct |
0 ms |
2024 KB |
Output is correct |
11 |
Correct |
0 ms |
2024 KB |
Output is correct |
12 |
Correct |
0 ms |
2024 KB |
Output is correct |
13 |
Correct |
0 ms |
2156 KB |
Output is correct |
14 |
Correct |
0 ms |
2156 KB |
Output is correct |
15 |
Correct |
0 ms |
2024 KB |
Output is correct |
16 |
Correct |
0 ms |
2024 KB |
Output is correct |
17 |
Correct |
0 ms |
2024 KB |
Output is correct |
18 |
Correct |
0 ms |
2024 KB |
Output is correct |
19 |
Correct |
0 ms |
2024 KB |
Output is correct |
20 |
Correct |
0 ms |
2024 KB |
Output is correct |
21 |
Correct |
0 ms |
2552 KB |
Output is correct |
22 |
Correct |
0 ms |
2552 KB |
Output is correct |
23 |
Correct |
0 ms |
2024 KB |
Output is correct |
24 |
Correct |
3 ms |
2552 KB |
Output is correct |
25 |
Correct |
0 ms |
2024 KB |
Output is correct |
26 |
Correct |
0 ms |
2552 KB |
Output is correct |
27 |
Correct |
3 ms |
2552 KB |
Output is correct |
28 |
Correct |
6 ms |
2552 KB |
Output is correct |
29 |
Correct |
3 ms |
2684 KB |
Output is correct |
30 |
Correct |
6 ms |
2684 KB |
Output is correct |
31 |
Correct |
3 ms |
2684 KB |
Output is correct |
32 |
Correct |
3 ms |
2552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
419 ms |
3212 KB |
Output is correct |
2 |
Memory limit exceeded |
466 ms |
131072 KB |
Memory limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
101864 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Memory limit exceeded |
403 ms |
131072 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Memory limit exceeded |
416 ms |
131072 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |