Submission #403698

#TimeUsernameProblemLanguageResultExecution timeMemory
403698opukittpceno_hhrPalindromes (APIO14_palindrome)C++17
23 / 100
1092 ms131076 KiB
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <algorithm> #include <string> #include <cmath> #include <cstdio> #include <iomanip> #include <fstream> #include <cassert> #include <cstring> #include <unordered_set> #include <unordered_map> #include <numeric> #include <ctime> #include <bitset> #include <complex> #include <chrono> #include <random> #include <functional> using namespace std; int pal(string s) { string t = s; reverse(t.begin(), t.end()); return s == t; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int n = (int)s.size(); map<string, int> cnt; int ans = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { string ts = s.substr(i, j - i + 1); if (pal(ts)) { cnt[ts]++; ans = max(ans, cnt[ts] * (j - i + 1)); } } } cout << ans << endl; }
#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...