| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 545914 | rainboy | Palindromic Partitions (CEOI17_palindromic) | C11 | 139 ms | 16748 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N 1000000
int main() {
int t;
scanf("%d", &t);
while (t--) {
static char cc[N + 1], cc_[N * 2 + 2];
static int rr[N * 2 + 1];
int n, i, j, o, x, ans;
scanf("%s", cc), n = strlen(cc);
for (i = 0; i <= n * 2; i++)
cc_[i] = i % 2 == 0 ? ' ' : (i / 2 % 2 == 0 ? cc[i / 4] : cc[n - 1 - i / 4]);
cc_[n * 2 + 1] = 0;
for (i = 0, o = x = 0; i <= n * 2; i++)
if (o + o - i >= 0 && i + rr[o + o - i] < x)
rr[i] = rr[o + o - i];
else {
o = i;
while (x <= n * 2 && o + o - x >= 0 && cc_[x] == cc_[o + o - x])
x++;
rr[i] = x - o;
}
ans = 0;
for (i = 0, j = 2; j <= n; j += 2)
if (rr[i + j] > j - i)
i = j, ans += 2;
if (i < n)
ans++;
printf("%d\n", ans);
}
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... | ||||
