Submission #897617

#TimeUsernameProblemLanguageResultExecution timeMemory
897617AndrijaMPalindromes (APIO14_palindrome)C++14
0 / 100
558 ms131072 KiB
#include <bits/stdc++.h> using namespace std; const long long maxn=1e4+10; const long long mod=1e9+7; int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); string s; cin>>s; int n=s.size(); map<string,int>m; for(int i=0;i<n;i++) { int l=i; int r=i; while(l-1>=0 && r+1<n) { if(s[l-1]==s[r+1]) { l--; r++; } else { break; } } string str=""; for(int j=l;j<=r;j++) { str+=s[j]; } m[str]++; } for(int i=0;i<n-1;i++) { int l=i; int r=i+1; if(s[l]!=s[r])continue; while(l-1>=0 && r+1<n) { if(s[l-1]==s[r+1]) { l--; r++; } else { break; } } string str=""; for(int j=l;j<=r;j++) { str+=s[j]; } m[str]++; } long long ans=0; for(auto ax:m) { long long num=ax.first.size()*ax.second; ans=max(num,ans); } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...