Submission #1103892

#TimeUsernameProblemLanguageResultExecution timeMemory
1103892ezzzayPalindromic Partitions (CEOI17_palindromic)C++14
60 / 100
10031 ms6584 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back vector<int>ans; void fun(){ string s; cin>>s; int n=s.size(); string a,b; int x=-1; int p=0; for(int i=0;i<n/2;i++){ a+=s[i]; b=s[n-i-1]+b; if(a==b){ x=i; a.clear(); b.clear(); p+=2; } //cout<<a<<" "<<b<<endl; } if(n%2 or x<n/2-1)p++; ans.pb(p); } signed main(){ int t; cin>>t; while(t--)fun(); for(auto a:ans)cout<<a<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...