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 <vector>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <numeric>
#include <list>
#include <array>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <iomanip>
#include <unordered_map>
using namespace std;
#define sx (int)s.size()
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL);}
#define f first
#define s second
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;
const int N = 1e6;
string s;
int mx() {
int temp = s.size();
unordered_map <string, int> palindrom;
int mxv = 0;
auto cnt = [&] (int l, int r) {
while (l >= 0 && r < temp && s[l] == s[r]) {
string pal = s.substr(l, r - l + 1);
palindrom[pal]++;
l--;
r++;
}
};
for (int i = 0; i < temp; ++i) {
cnt(i, i);
cnt(i, i + 1);
}
for (auto i : palindrom) {
int nw = i.s * (i.f).size();
mxv = max(mxv, nw);
}
return mxv;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> s;
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... |