Submission #976188

#TimeUsernameProblemLanguageResultExecution timeMemory
976188princePalindromes (APIO14_palindrome)C++17
23 / 100
1063 ms13532 KiB
#include<bits/stdc++.h> using namespace std; int main(){ #ifdef prince freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cin.tie(nullptr)->sync_with_stdio(false); string s;cin>>s; int n=s.size(); map<string,int>mp; // string a;a+=s[0];mp[a]++;a="";a+=s[n-1];mp[a]++; for(int i=0;i<n;++i){ string p1; p1+=s[i]; int l=i-1,r=i+1; while(l>=0&&r<n&&s[l]==s[r]){ mp[p1]++; p1+=s[l];p1+=s[r]; l--;r++; } mp[p1]++; string p2; l=i-1;r=i; while(l>=0&&r<n&&s[l]==s[r]){ p2+=s[l];p2+=s[r]; mp[p2]++; l--;r++; } } int mx=0; for(auto &[x,y]:mp){ // cout<<x<<" "<<y<<endl; mx=max(mx,(int)x.size()*y); } cout<<mx; }
#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...