Submission #976188

# Submission time Handle Problem Language Result Execution time Memory
976188 2024-05-06T09:21:37 Z prince Palindromes (APIO14_palindrome) C++17
23 / 100
1000 ms 13532 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    #ifdef prince
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin.tie(nullptr)->sync_with_stdio(false);
    string s;cin>>s;
    int n=s.size();
    map<string,int>mp;
    // string a;a+=s[0];mp[a]++;a="";a+=s[n-1];mp[a]++;
    for(int i=0;i<n;++i){
        string p1;
        p1+=s[i];
        int l=i-1,r=i+1;
        while(l>=0&&r<n&&s[l]==s[r]){
            mp[p1]++;
            p1+=s[l];p1+=s[r];
            l--;r++;
        }
        mp[p1]++;
        string p2;
        l=i-1;r=i;
        while(l>=0&&r<n&&s[l]==s[r]){
            p2+=s[l];p2+=s[r];
            mp[p2]++;
            l--;r++;
        }
    }
    int mx=0;
    for(auto &[x,y]:mp){
        // cout<<x<<" "<<y<<endl;
        mx=max(mx,(int)x.size()*y);
    }
    cout<<mx;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 404 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 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 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 856 KB Output is correct
2 Correct 10 ms 604 KB Output is correct
3 Correct 52 ms 860 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 52 ms 860 KB Output is correct
6 Correct 51 ms 1036 KB Output is correct
7 Correct 1 ms 860 KB Output is correct
8 Correct 26 ms 968 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 12660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1010 ms 13136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 13532 KB Time limit exceeded
2 Halted 0 ms 0 KB -