Submission #134980

#TimeUsernameProblemLanguageResultExecution timeMemory
134980qrnoPalindromes (APIO14_palindrome)C++14
0 / 100
1091 ms101476 KiB
#include <iostream> #include <string> #include <map> using namespace std; map <string, int> M; string a; inline bool isPalindrome(int l, int r) { for (int i = l; i <= r; i++) { if (a[i] != a[r-i]) return false; } return true; } int main() { cin >> a; int ans = 0; for (int i = 0; i < a.size(); i++) { for (int j = i; j < a.size(); j++) { if (isPalindrome(i, j)) { string s; for (int k = i; k <= j; k++) s+=a[i]; M[s]++; ans = max(ans, (j-i+1)*M[s]); } } } cout << ans << endl; return 0; }

Compilation message (stderr)

palindrome.cpp: In function 'int main()':
palindrome.cpp:23:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < a.size(); i++) {
                     ~~^~~~~~~~~~
palindrome.cpp:24:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = i; j < a.size(); j++) {
                         ~~^~~~~~~~~~
#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...