Submission #898381

#TimeUsernameProblemLanguageResultExecution timeMemory
898381drdilyorPalindromes (APIO14_palindrome)C++17
8 / 100
1043 ms131072 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; signed main() { cin.tie(0)->sync_with_stdio(0); string s; cin >> s; int n = s.size(); ll ans = 0; map<string, int> mp; for (int l = 0; l < n; l++) { for (int r = l; r < n; r++) { string t = s.substr(l, r - l + 1); mp[t]++; string rev = t; reverse(rev.begin(), rev.end()); bool ispal = t == rev; if (ispal) { ans = max(ans, (ll)(r - l + 1) * mp[t]); } } } cout << ans << '\n'; 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...