Submission #1125454

#TimeUsernameProblemLanguageResultExecution timeMemory
1125454dwuyPalindromic Partitions (CEOI17_palindromic)C++17
60 / 100
10083 ms3888 KiB
#include <bits/stdc++.h> using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int q; cin >> q; while(q--){ string s; cin >> s; int ans = 0; int i=0, j=(int)s.size()-1; string L, R; L = R = ""; for(;i<j;i++,j--){ L += s[i]; R = s[j] + R; if(L == R){ ans += 2; L = R = ""; } } if(i <= j || L.size()) ans++; cout << ans << '\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...