Submission #468930

#TimeUsernameProblemLanguageResultExecution timeMemory
468930AutumnPalindromic Partitions (CEOI17_palindromic)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t bool check(int s1, int s2, int l, string s){ for(int i=0;i<l;i++){ if(s[s1]!=s[s2])return false; s1++; s2++; } return true; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int t; cin>>t; for(int T=0;T<t;T++){ string s; cin>>s; int n=s.size(); int pal=1; int is=0; int jcurr=n-1; int jend=n; while(jcurr>=(n+1)/2){ if(check(is,jcurr,jend-jcurr, s)){ pal+=2; is+=(jend-jcurr); jend=jcurr; } jcurr--; } cout<<pal<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...