Submission #898381

# Submission time Handle Problem Language Result Execution time Memory
898381 2024-01-04T14:56:42 Z drdilyor Palindromes (APIO14_palindrome) C++17
8 / 100
1000 ms 131072 KB
#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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 452 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 608 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 2 ms 856 KB Output is correct
22 Correct 2 ms 860 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 2 ms 604 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 2 ms 784 KB Output is correct
27 Correct 2 ms 716 KB Output is correct
28 Correct 2 ms 860 KB Output is correct
29 Correct 2 ms 860 KB Output is correct
30 Correct 3 ms 968 KB Output is correct
31 Correct 2 ms 860 KB Output is correct
32 Correct 2 ms 712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 236 ms 1876 KB Output is correct
2 Runtime error 246 ms 131072 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 102604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 222 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 222 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -