# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134990 | qrno | Palindromes (APIO14_palindrome) | C++14 | 1080 ms | 62672 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;
inline bool isPalindrome(string s) {
for (int i = 0; i < s.size(); i++) {
if (s[i] != s[s.size()-i-1])
return false;
}
return true;
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
string a;
cin >> a;
int ans = 0;
for (int i = 0; i < a.size(); i++) {
for (int j = i; j < a.size(); j++) {
string s = "";
for (int m = i; m <= j; m++) {
s += a[m];
}
if (isPalindrome(s)) {
M[s]++;
int m = s.size();
ans = max(ans, m*M[s]);
}
}
}
cout << ans << '\n';
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... |