Submission #858402

#TimeUsernameProblemLanguageResultExecution timeMemory
858402Tenis0206Palindromic Partitions (CEOI17_palindromic)C++11
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> using namespace std; string s; int solve(int st, int dr) { for(int len=1;st + len - 1 < dr - len + 1;len++) { bool ok = true; for(int i=1;i<=len;i++) { if(s[st + i - 1] != s[dr - len + i]) { ok = false; break; } } if(ok) { return 2 + solve(st + len, dr - len); } } return 1; } void solve_test() { cin>>s; s = "#" + s; cout<<solve(1,s.size() - 1)<<'\n'; } int main() { int t; cin>>t; for(int test=1;test<=t;test++) { solve_test(); } 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...