# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
481410 | 2021-10-20T17:35:05 Z | rainboy | Klasika (COCI20_klasika) | C | 5000 ms | 3892 KB |
#include <stdio.h> #include <stdlib.h> #define N 200000 int max(int a, int b) { return a > b ? a : b; } int *ej[N], eo[N]; void append(int i, int j) { int o = eo[i]++; if (o == 0 || o >= 2 && (o & o - 1) == 0) ej[i] = (int *) realloc(ej[i], (o == 0 ? 2 : o * 2) * sizeof *ej[i]); ej[i][o] = j; } int aa[N]; int dfs(int i, int a) { int x = aa[i] ^ a, o; for (o = eo[i]; o--; ) { int j = ej[i][o]; x = max(x, dfs(j, a)); } return x; } int main() { int n, q; scanf("%d", &q); n = 1; while (q--) { static char s[8]; int i, j; scanf("%s%d", s, &i), i--; if (s[0] == 'A') { j = n++; scanf("%d", &aa[j]), aa[j] ^= aa[i]; append(i, j); } else { scanf("%d", &j), j--; printf("%d\n", dfs(j, aa[i])); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 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 | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 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 | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 2 ms | 296 KB | Output is correct |
14 | Correct | 3 ms | 296 KB | Output is correct |
15 | Correct | 3 ms | 332 KB | Output is correct |
16 | Correct | 3 ms | 332 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 2 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 2 ms | 296 KB | Output is correct |
23 | Correct | 2 ms | 332 KB | Output is correct |
24 | Correct | 2 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5022 ms | 3892 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 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 | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 2 ms | 296 KB | Output is correct |
14 | Correct | 3 ms | 296 KB | Output is correct |
15 | Correct | 3 ms | 332 KB | Output is correct |
16 | Correct | 3 ms | 332 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 2 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 2 ms | 296 KB | Output is correct |
23 | Correct | 2 ms | 332 KB | Output is correct |
24 | Correct | 2 ms | 332 KB | Output is correct |
25 | Execution timed out | 5022 ms | 3892 KB | Time limit exceeded |
26 | Halted | 0 ms | 0 KB | - |