Submission #23585

# Submission time Handle Problem Language Result Execution time Memory
23585 2017-05-12T18:01:03 Z Hassoony Palindromes (APIO14_palindrome) C++14
8 / 100
1000 ms 131072 KB
#include<bits/stdc++.h>
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define R return
#define F first
#define S second
#define C continue
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int MX=1009;
const ll mod=1e9+7;
const ll inf=(1ll<<60);
ll p[MX][MX],n;
string s;
map<string,pll>m;
int main(){
    cin>>s;
    n=s.size();
    for(int i=0;i<n;i++){
        string tmp="";
        for(int j=i;j<n;j++){
            tmp+=s[j];
            m[tmp].F=i;
            m[tmp].S++;
        }
    }
    ll ans=0;
    for(auto pp:m){
        string x=pp.F;
        ll i=pp.S.F,b=0;
        ll k=pp.S.S;
        ll y=x.size();
        for(int i=0;i<y/2;i++){
            if(x[i]!=x[y-i-1])b=1;
        }
        if(!b)ans=max(ans,y*k);
    }
    cout<<ans<<endl;
}

Compilation message

palindrome.cpp: In function 'int main()':
palindrome.cpp:32:12: warning: unused variable 'i' [-Wunused-variable]
         ll i=pp.S.F,b=0;
            ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9976 KB Output is correct
2 Correct 0 ms 9976 KB Output is correct
3 Correct 0 ms 9976 KB Output is correct
4 Correct 0 ms 9976 KB Output is correct
5 Correct 0 ms 9976 KB Output is correct
6 Correct 0 ms 9976 KB Output is correct
7 Correct 0 ms 9976 KB Output is correct
8 Correct 0 ms 9976 KB Output is correct
9 Correct 0 ms 9976 KB Output is correct
10 Correct 0 ms 9976 KB Output is correct
11 Correct 0 ms 9976 KB Output is correct
12 Correct 0 ms 9976 KB Output is correct
13 Correct 0 ms 10108 KB Output is correct
14 Correct 0 ms 10108 KB Output is correct
15 Correct 0 ms 9976 KB Output is correct
16 Correct 0 ms 9976 KB Output is correct
17 Correct 0 ms 9976 KB Output is correct
18 Correct 0 ms 9976 KB Output is correct
19 Correct 0 ms 9976 KB Output is correct
20 Correct 0 ms 9976 KB Output is correct
21 Correct 3 ms 10504 KB Output is correct
22 Correct 6 ms 10504 KB Output is correct
23 Correct 0 ms 9976 KB Output is correct
24 Correct 3 ms 10504 KB Output is correct
25 Correct 0 ms 9976 KB Output is correct
26 Correct 3 ms 10504 KB Output is correct
27 Correct 3 ms 10504 KB Output is correct
28 Correct 3 ms 10504 KB Output is correct
29 Correct 6 ms 10636 KB Output is correct
30 Correct 6 ms 10636 KB Output is correct
31 Correct 3 ms 10636 KB Output is correct
32 Correct 3 ms 10504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 379 ms 11164 KB Output is correct
2 Memory limit exceeded 433 ms 131072 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 109816 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Memory limit exceeded 403 ms 131072 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Memory limit exceeded 393 ms 131072 KB Memory limit exceeded
2 Halted 0 ms 0 KB -