# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
468962 | Josia | Palindromic Partitions (CEOI17_palindromic) | C++14 | 1 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
signed main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
int n; cin >> n;
while (n--) {
string s; cin >> s;
int pos = 0;
int res = 0;
while (pos<=s.size()/2) {
bool worksOuter = 0;
for (int i = 1; i<=(s.size()-2*pos)/2; i++) {
bool works = 1;
for (int j = 0; j<i; j++) {
if (s[j+pos] != s[s.size()-pos-i+j]) {
works = 0;
break;
}
}
if (works) {
// cout << pos << " " << i << "\n";
worksOuter = 1;
pos += i;
res+=2;
break;
}
}
if (!worksOuter) {
res++;
break;
}
}
cout << res << "\n";
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |