Submission #967543

#TimeUsernameProblemLanguageResultExecution timeMemory
967543KasymKPalindromes (APIO14_palindrome)C++17
23 / 100
1031 ms131072 KiB
#include "bits/stdc++.h" using namespace std; bool pal(string s){ int l = 0, r = (int)s.size() - 1; while(l < r){ if(s[l] != s[r]) return 0; l++, r--; } return 1; } int main(){ string s; cin >> s; int n = (int)s.size(); unordered_map<string, int> mp; for(int i = 0; i < n; ++i){ string str = ""; for(int j = i; j < n; ++j){ str += s[j]; if(pal(str)) mp[str]++; } } int jog = -1; for(auto &to : mp) jog = max(jog, (int)to.first.size()*to.second); printf("%d\n", jog); 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...