Submission #134997

#TimeUsernameProblemLanguageResultExecution timeMemory
134997Kenzo_1114Palindromes (APIO14_palindrome)C++14
23 / 100
1063 ms50264 KiB
#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)

palindrome.cpp: In function 'int main()':
palindrome.cpp:34:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<word.size();i++)
              ~^~~~~~~~~~~~
palindrome.cpp:36:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=i;j<word.size();j++)
               ~^~~~~~~~~~~~
palindrome.cpp:31:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %s",aux);
  ~~~~~^~~~~~~~~~~
#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...