# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
362640 | shahriarkhan | Palindromic Partitions (CEOI17_palindromic) | C++14 | 10006 ms | 6436 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std ;
int main()
{
int t ;
scanf("%d",&t) ;
while(t--)
{
string s ;
cin>>s ;
int siz = s.size() , l = 0 , r = siz - 1 , len = 1 , ans = 0 ;
while((l+len-1)<r)
{
int cur_l = l , cur_r = r , bad = 0 ;
while(cur_l<(l+len))
{
if(s[cur_l]==s[cur_r])
{
++cur_l , ++cur_r ;
}
else
{
bad = 1 ;
break ;
}
}
if(!bad)
{
l += len , len = 1 ;
--r , ans += 2 ;
}
else
{
++len , --r ;
}
}
if(l<=r) ++ans ;
printf("%d\n",max(1,ans)) ;
}
return 0 ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |