Submission #312023

#TimeUsernameProblemLanguageResultExecution timeMemory
312023FatihSolakPalinilap (COI16_palinilap)C++14
0 / 100
1099 ms21024 KiB
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; long long ans=0; long long arr[s.length()][26]; for(int i=0;i<s.length();i++){ for(int j=0;j<26;j++){ arr[i][j]=0; } } for(int i=0;i<s.length();i++){ for(int j=i;j<s.length();j++){ string a=""; for(int c=i;c<=j;c++){ a +=s[c]; } string b=a; reverse(a.begin(),a.end()); if(b == a){ ans++; } else{ for(int h=0;h<(j-i)/2;h++){ if(b[h] != a[h]){ string d =""; for(int c=i;c<=j;c++){ if(c == i+h || c == j-h){ continue; } d+=s[c]; } string e=d; reverse(d.begin(),d.end()); if(d==e){ arr[i][b[0]-'a']++; arr[j][a[0]-'a']++; } } } } } } long long maxi=0; for(int i=0;i<s.length();i++){ for(int j=0;j<26;j++){ maxi = max(maxi,arr[i][j]); } } cout << maxi +ans; }

Compilation message (stderr)

palinilap.cpp: In function 'int main()':
palinilap.cpp:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i=0;i<s.length();i++){
      |                 ~^~~~~~~~~~~
palinilap.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<s.length();i++){
      |                 ~^~~~~~~~~~~
palinilap.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int j=i;j<s.length();j++){
      |                     ~^~~~~~~~~~~
palinilap.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int i=0;i<s.length();i++){
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...