Submission #199672

# Submission time Handle Problem Language Result Execution time Memory
199672 2020-02-02T16:50:48 Z rKrPaN Palindromic Partitions (CEOI17_palindromic) C++
60 / 100
10000 ms 3248 KB
#include <iostream>
#include <string>

using namespace std;

int main(){

	int t;
	cin >> t;
	for (int ij = 0; ij < t; ij++){
		
		string s;
		cin >> s;
		
		int sol = 1;
		
		int n = s.size();
		int d = 1, o = 0;
		for (int i = 0; i < n/2; i++){
			
			int boo = 1;
			for (int j = 0; j < d; j++){
				if (s[o+j] != s[n-o-d+j]){
					boo = 0;
					break;
				}
			}
			
			if (boo){
				o += d;
				d = 0;
				sol+= 2;
			}
			
			d++;
		}
		if (n%2 == 0 && d == 1)sol--;
		cout << sol << "\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 22 ms 376 KB Output is correct
11 Correct 12 ms 376 KB Output is correct
12 Correct 10 ms 376 KB Output is correct
13 Correct 10 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 22 ms 376 KB Output is correct
11 Correct 12 ms 376 KB Output is correct
12 Correct 10 ms 376 KB Output is correct
13 Correct 10 ms 380 KB Output is correct
14 Execution timed out 10009 ms 3248 KB Time limit exceeded
15 Halted 0 ms 0 KB -