# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134997 | Kenzo_1114 | Palindromes (APIO14_palindrome) | C++14 | 1063 ms | 50264 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int MAXN=10010;
map<string,int> resp;
map<string,int>::iterator mit;
string word;
char aux[MAXN];
long long int RESP;
void valid(int i,int j)
{
int mid=(j-i)/2, cont=0, ok=1;
char novo[MAXN];
for(int k=0;k<=mid;k++)
if(word[i+k]!=word[j-k]) ok=0;
if(ok)
for(int k=i;k<=j;k++)
novo[cont]=word[k], cont++;
novo[cont]='\0';
// printf("i = %d j = %d ok = %d novo = %s\n",i,j,ok,novo);
if(ok) resp[(string)novo]++;
}
int main ()
{
scanf(" %s",aux);
word=(string)aux;
for(int i=0;i<word.size();i++)
{
for(int j=i;j<word.size();j++)
{
valid(i,j);
}
}
for(mit=resp.begin();mit!=resp.end();mit++)
{
RESP=max(RESP,(long long int )(*mit).first.size()*(*mit).second);
}
printf("%lld\n",RESP);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |