Submission #468934

#TimeUsernameProblemLanguageResultExecution timeMemory
468934AutumnPalindromic Partitions (CEOI17_palindromic)C++17
60 / 100
10050 ms3432 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)){ if(jcurr==n/2)pal--; 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...