Submission #519559

# Submission time Handle Problem Language Result Execution time Memory
519559 2022-01-26T16:38:10 Z MurotY Palindromic Partitions (CEOI17_palindromic) C++14
60 / 100
10000 ms 7248 KB
#include <bits/stdc++.h>
#define ll long long
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
using namespace std;
const int N=2*1e5+7, M=1e9+7;

int main()
{
	ios;
	int t;
	cin >> t;
	
	while (t--){
		string s;
		cin >> s;
		int l=0, r=s.size()-1, ans=0;
		string lf, rg;
		while (r >= l){
			lf+=s[l];
			rg=s[r]+rg;
			if (lf == rg){
				lf.clear();
				rg.clear();
				ans+=2-(l == r);
			}
			l++;
			r--;
		}
		if (lf.size()) ans++;
		cout << ans <<"\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 5 ms 460 KB Output is correct
11 Correct 4 ms 460 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 5 ms 460 KB Output is correct
11 Correct 4 ms 460 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Execution timed out 10043 ms 7248 KB Time limit exceeded
15 Halted 0 ms 0 KB -