답안 #447367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447367 2021-07-26T07:29:36 Z fuad27 Palindromic Partitions (CEOI17_palindromic) C++14
60 / 100
10000 ms 4532 KB
#include<iostream>
using namespace std;
#define int long long
#pragma GCC optimize("Os")
int32_t main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);	
	int t;
	cin >> t;
	while(t--) {
		string s;
		cin >> s;
		int ans = 0, n = s.length();
		string l = "", r = "";
		for(int i = 0;i<n/2;i++) {
			l += s[i];
			r = s[n-i-1] + r;
			if(l == r){
				l = "";
				r = "";
				ans+=2;
			}
		}
		if(l.size() > 0 or n%2 == 1)ans++;
		cout<<ans<<'\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 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 6 ms 460 KB Output is correct
11 Correct 6 ms 452 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 4 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 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 6 ms 460 KB Output is correct
11 Correct 6 ms 452 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 4 ms 332 KB Output is correct
14 Execution timed out 10101 ms 4532 KB Time limit exceeded
15 Halted 0 ms 0 KB -