Submission #199672

#TimeUsernameProblemLanguageResultExecution timeMemory
199672rKrPaNPalindromic Partitions (CEOI17_palindromic)C++98
60 / 100
10009 ms3248 KiB
#include <iostream> #include <string> using namespace std; int main(){ int t; cin >> t; for (int ij = 0; ij < t; ij++){ string s; cin >> s; int sol = 1; int n = s.size(); int d = 1, o = 0; for (int i = 0; i < n/2; i++){ int boo = 1; for (int j = 0; j < d; j++){ if (s[o+j] != s[n-o-d+j]){ boo = 0; break; } } if (boo){ o += d; d = 0; sol+= 2; } d++; } if (n%2 == 0 && d == 1)sol--; cout << sol << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...