Submission #311616

#TimeUsernameProblemLanguageResultExecution timeMemory
311616biggPalindromic Partitions (CEOI17_palindromic)C++14
60 / 100
10078 ms6088 KiB
#include<bits/stdc++.h> using namespace std; string s; int main(){ int t; cin >> t; while(t--){ cin >> s; int ans = 0; string esq = ""; string dir = ""; for(int i = 0; i < s.length()/2; i++){ esq.push_back(s[i]); dir = (s[s.length()-i-1]) + dir; if(esq == dir){ esq.clear(), dir.clear(); ans += 2; } } if(s.length()%2 || esq.length())ans++; cout << ans << endl; } }

Compilation message (stderr)

palindromic.cpp: In function 'int main()':
palindromic.cpp:12:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for(int i = 0; i < s.length()/2; 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...