Submission #1119465

#TimeUsernameProblemLanguageResultExecution timeMemory
1119465vjudge1Palindromes (APIO14_palindrome)C++17
23 / 100
1048 ms10484 KiB
#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 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...