| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 926408 | rainboy | Cezar (COCI16_cezar) | C11 | 1 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 100
#define L 100
#define A 26
int *fa[A], fo[A], eo[A];
void append(int b, int a) {
int o = fo[b]++;
if (o >= 2 && (o & o - 1) == 0)
fa[b] = (int *) realloc(fa[b], o * 2 * sizeof *fa[b]);
fa[b][o] = a, eo[a]++;
}
int main() {
static char ss[N][L + 1], cc[A + 1];
static int ii[N], ll[N];
int n, g, h, i, j, a, b, c, o;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%s", ss[i]), ll[i] = strlen(ss[i]);
for (h = 0; h < n; h++)
scanf("%d", &ii[h]), ii[h]--;
for (a = 0; a < A; a++)
fa[a] = (int *) malloc(2 * sizeof *fa[a]);
for (h = 0; h + 1 < n; h++) {
i = ii[h], j = ii[h + 1];
for (g = 0; g < ll[i] && g < ll[j]; g++)
if (ss[i][g] != ss[j][g]) {
append(ss[j][g] - 'a', ss[i][g] - 'a');
break;
}
if (g == ll[j]) {
printf("NE\n");
return 0;
}
}
for (c = A - 1; c >= 0; c--) {
for (b = A - 1; b >= 0; b--)
if (eo[b] == 0)
break;
if (b == A) {
printf("NE\n");
return 0;
}
cc[b] = c + 'a';
eo[b] = -1;
for (o = fo[b]; o--; ) {
a = fa[b][o];
eo[a]--;
}
}
printf("DA\n");
printf("%s\n", cc);
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... | ||||
| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
