Submission #199671

#TimeUsernameProblemLanguageResultExecution timeMemory
199671rKrPaNPalindromic Partitions (CEOI17_palindromic)C++98
60 / 100
10019 ms3368 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++){ string a = s.substr(o, d); string b = s.substr(n-o-d, d); if (a == b){ 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...