Submission #134899

#TimeUsernameProblemLanguageResultExecution timeMemory
134899wmrmrPalindromes (APIO14_palindrome)C++17
0 / 100
1075 ms3348 KiB
#include <bits/stdc++.h> using namespace std; long long int ans; map<string,int> m; map<string,int>::iterator mit; string s; void Insert() { int tam = s.size(); for(int i=0;i<tam;i++) { string aux; int maxt = min( i+1, tam-i ); for(int j=0;j<maxt;j++) { if( s[i+j] != s[i-j] ) break; aux.push_back(s[i+j]); if(m.find(aux) == m.end()) m.insert({aux,1}); else m[aux]++; } } return; } int main() { cin >> s; Insert(); for(mit = m.begin();mit!=m.end();mit++) { int tam = (mit->first).size(), qtd = mit->second; ans = max( ans , (long long int) qtd*(2*tam-1) ); } printf("%lld",ans); }
#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...