제출 #1128553

#제출 시각아이디문제언어결과실행 시간메모리
1128553PagodePaivaPalindromic Partitions (CEOI17_palindromic)C++17
60 / 100
10081 ms3048 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; void solve(){ string s; cin >> s; int res = 0; int l = 0, r = s.size(); r--; string a, b; while(l < r){ a.push_back(s[l]); reverse(b.begin(), b.end()); b.push_back(s[r]); reverse(b.begin(), b.end()); if(a == b){ a.clear(); b.clear(); res += 2; } l++; r--; } if(a.empty() and l != r){ cout << res << endl; } else cout << res+1 << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...