Submission #718851

# Submission time Handle Problem Language Result Execution time Memory
718851 2023-04-05T01:26:39 Z irmuun Palindromes (APIO14_palindrome) C++17
23 / 100
1000 ms 131072 KB
#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(s) s.begin(),s.end()

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    ll n=s.size();
    ll ans=0;
    map<string,ll>m;
    bool ok;
    for(ll i=0;i<n;i++){
        string t="";
        ll cur=0;
        for(ll j=i;j<n;j++){
            t+=s[j];
            cur++;
            ok=true;
            for(ll k=0;k<cur;k++){
                if(t[k]!=t[cur-k-1]){
                    ok=false;
                    break;
                }
            }
            if(ok==true){
                m[t]++;
            }
        }
    }
    for(auto [t,x]:m){
        ans=max(ans,(ll)t.size()*(ll)x);
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 328 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 896 KB Output is correct
2 Correct 30 ms 628 KB Output is correct
3 Correct 198 ms 904 KB Output is correct
4 Correct 8 ms 340 KB Output is correct
5 Correct 219 ms 888 KB Output is correct
6 Correct 210 ms 884 KB Output is correct
7 Correct 6 ms 724 KB Output is correct
8 Correct 101 ms 852 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 4 ms 212 KB Output is correct
11 Correct 4 ms 212 KB Output is correct
12 Correct 6 ms 576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 50164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 219 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 259 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -