Submission #199671

# Submission time Handle Problem Language Result Execution time Memory
199671 2020-02-02T16:43:43 Z rKrPaN Palindromic Partitions (CEOI17_palindromic) C++
60 / 100
10000 ms 3368 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++){
			
			string a = s.substr(o, d);
			string b = s.substr(n-o-d, d);
			
			if (a == b){
				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 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 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 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 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 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 19 ms 376 KB Output is correct
11 Correct 16 ms 376 KB Output is correct
12 Correct 16 ms 376 KB Output is correct
13 Correct 11 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 19 ms 376 KB Output is correct
11 Correct 16 ms 376 KB Output is correct
12 Correct 16 ms 376 KB Output is correct
13 Correct 11 ms 376 KB Output is correct
14 Execution timed out 10019 ms 3368 KB Time limit exceeded
15 Halted 0 ms 0 KB -