Submission #1093966

#TimeUsernameProblemLanguageResultExecution timeMemory
1093966Trisanu_DasPalindromes (APIO14_palindrome)C++17
23 / 100
1043 ms131072 KiB
#include <bits/stdc++.h> using namespace std; string s; vector<string>v; set<string>st; map<string,int>mp; bool check(string x){ string xx=x; reverse(xx.begin(),xx.end()); if(x==xx) return 1; return 0; } void edit(){ for(set<string>::iterator i=st.begin();i!=st.end();i++){ v.push_back(*i); } } int main(){ cin>>s; for(int i=0;i<s.size();i++){ string x=""; for(int j=i;j<s.size();j++){ x+=s[j]; if(check(x)){ st.insert(x); mp[x]++; } } } edit(); long long mx=0; for(int i=0;i<v.size();i++){ mx=max(mx,(long long)v[i].size()*mp[v[i]]); } cout<<mx<<endl; }

Compilation message (stderr)

palindrome.cpp: In function 'int main()':
palindrome.cpp:20:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~
palindrome.cpp:22:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for(int j=i;j<s.size();j++){
      |                     ~^~~~~~~~~
palindrome.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
#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...