# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134978 | qrno | Palindromes (APIO14_palindrome) | C++14 | 1094 ms | 102672 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |