Submission #128040

# Submission time Handle Problem Language Result Execution time Memory
128040 2019-07-10T10:50:19 Z faustaadp Palindromic Partitions (CEOI17_palindromic) C++17
60 / 100
10000 ms 6528 KB
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
string s,s1,s2;
ll n,i,has,t;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>t;
	while(t--)
	{
		has=0;
		cin>>s;
		ll las1=0,las2=n-1;
		n=s.length();
		s1="";
		s2="";
		for(i=0;i<n;i++)
		{
			if(i>=(n-i-1))break;
			s1=s1+s[i];
			s2=s[n-i-1]+s2;
			if(s1==s2)
			{
				las1=i;
				las2=n-i-1;
				las1++;
				las2--;
				has+=2;
				s1="";
				s2="";
			}
		}
		if(las1<=las2)has++;
		cout<<has<<"\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 16 ms 504 KB Output is correct
11 Correct 15 ms 376 KB Output is correct
12 Correct 11 ms 376 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 16 ms 504 KB Output is correct
11 Correct 15 ms 376 KB Output is correct
12 Correct 11 ms 376 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Execution timed out 10089 ms 6528 KB Time limit exceeded
15 Halted 0 ms 0 KB -