Submission #23586

#TimeUsernameProblemLanguageResultExecution timeMemory
23586HassoonyPalindromes (APIO14_palindrome)C++14
8 / 100
1000 ms131072 KiB
#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 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 (stderr)

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 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...