This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
string a;
cin >> a;
map<string, int> mp;
int mx = 0, n = a.size();
for (int i = 0; i < n; ++i) {
string b = "";
b += a[i];
mp[b]++;
int l = i, r = i;
while (l > 0 && r < n - 1 && a[l - 1] == a[r + 1]) {
l--, r++;
b = a[l] + b + a[r];
mp[b]++;
}
}
for (int i = 0; i < n - 1; ++i) {
string b = "";
int l = i + 1, r = i;
while (l > 0 && r < n - 1 && a[l - 1] == a[r + 1]) {
l--, r++;
b = a[l] + b + a[r];
mp[b]++;
}
}
for (auto &[x, y] : mp) {
mx = max(y * (int) x.size(), mx);
}
cout << mx;
return 0;
}
# | 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... |