Submission #250281

# Submission time Handle Problem Language Result Execution time Memory
250281 2020-07-17T10:34:52 Z Pbezz Palindromic Partitions (CEOI17_palindromic) C++14
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

#define loop(i,n) for (ll i = 0; i < n; i++)

#define ll long long
#define INF 1e9+5
#define MAXN 300007
#define pb push_back 
#define mp make_pair
typedef pair<ll,ll> pii;




int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
 
	ll t,n;
	string s;
	cin>>t;
	while(t--){

	cin>>s;
	n=(ll)s.size();
	ll i=0,j=n-1,left=0,right=n-1,ans=1;
	string mleft, mright;

	while(i<j){

	mleft=s.substr(left,i-left+1);//de left a i
	mright=s.substr(j,right-j+1);//de j a right

	if(mleft==mright){ 

	left=i+1; right=j-1;
	ans+=2;

	}
	i++; j--;


	}

	cout<<ans<<'\n'; 





}

return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -