제출 #976209

#제출 시각아이디문제언어결과실행 시간메모리
976209JahonaliX회문 (APIO14_palindrome)C++17
23 / 100
1070 ms9184 KiB
#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 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...