提出 #45738766
ソースコード 拡げる
Copy
#include <stdio.h>#include <stdlib.h>#include <string.h>int N, M;char* visited;void dfs(int node, int parent) {char buffer[32];int k, i;int* edges;visited[node] = 1;if (scanf("%31s", buffer) != 1) exit(1);if (strcmp(buffer, "OK") == 0) exit(0);if (sscanf(buffer, "%d", &k) != 1) exit(1);edges = malloc(sizeof(*edges) * k);if (edges == NULL) exit(2);for (i = 0; i < k; i++) {if (scanf("%d", &edges[i]) != 1) exit(1);}for (i = 0; i < k; i++) {
#include <stdio.h> #include <stdlib.h> #include <string.h> int N, M; char* visited; void dfs(int node, int parent) { char buffer[32]; int k, i; int* edges; visited[node] = 1; if (scanf("%31s", buffer) != 1) exit(1); if (strcmp(buffer, "OK") == 0) exit(0); if (sscanf(buffer, "%d", &k) != 1) exit(1); edges = malloc(sizeof(*edges) * k); if (edges == NULL) exit(2); for (i = 0; i < k; i++) { if (scanf("%d", &edges[i]) != 1) exit(1); } for (i = 0; i < k; i++) { if (!visited[edges[i]]) { printf("%d\n", edges[i]); fflush(stdout); dfs(edges[i], node); } } free(edges); printf("%d\n", parent); fflush(stdout); } int main(void) { if (scanf("%d%d", &N, &M) != 2) return 1; visited = calloc(N + 1, sizeof(*visited)); if (visited == NULL) return 2; dfs(1, 0); return 0; }
提出情報
提出日時 | |
---|---|
問題 | F - Dungeon Explore |
ユーザ | mikecat |
言語 | C (gcc 12.2.0) |
得点 | 0 |
コード長 | 842 Byte |
結果 | RE |
実行時間 | 5 ms |
メモリ | 3976 KB |
ジャッジ結果
セット名 | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
得点 / 配点 | 0 / 0 | 0 / 525 | ||||||||
結果 |
|
|
セット名 | テストケース |
---|---|
Sample | 00_sample_00.txt |
All | 00_sample_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt |
ケース名 | 結果 | 実行時間 | メモリ |
---|---|---|---|
00_sample_00.txt | AC | 2 ms | 3684 KB |
01_random_01.txt | AC | 3 ms | 3672 KB |
01_random_02.txt | AC | 3 ms | 3640 KB |
01_random_03.txt | RE | 2 ms | 3852 KB |
01_random_04.txt | WA | 3 ms | 3660 KB |
01_random_05.txt | AC | 2 ms | 3792 KB |
01_random_06.txt | AC | 2 ms | 3796 KB |
01_random_07.txt | AC | 3 ms | 3804 KB |
01_random_08.txt | WA | 3 ms | 3648 KB |
01_random_09.txt | AC | 2 ms | 3824 KB |
01_random_10.txt | RE | 2 ms | 3676 KB |
01_random_11.txt | RE | 2 ms | 3748 KB |
01_random_12.txt | RE | 2 ms | 3616 KB |
01_random_13.txt | AC | 3 ms | 3800 KB |
01_random_14.txt | AC | 4 ms | 3976 KB |
01_random_15.txt | AC | 5 ms | 3784 KB |
01_random_16.txt | AC | 4 ms | 3760 KB |
01_random_17.txt | AC | 3 ms | 3736 KB |
01_random_18.txt | AC | 2 ms | 3880 KB |
01_random_19.txt | WA | 2 ms | 3780 KB |
01_random_20.txt | WA | 2 ms | 3680 KB |
01_random_21.txt | AC | 2 ms | 3868 KB |
01_random_22.txt | AC | 2 ms | 3764 KB |
01_random_23.txt | WA | 3 ms | 3648 KB |
01_random_24.txt | WA | 2 ms | 3756 KB |
01_random_25.txt | AC | 2 ms | 3784 KB |
01_random_26.txt | AC | 2 ms | 3728 KB |
01_random_27.txt | RE | 2 ms | 3632 KB |
01_random_28.txt | RE | 3 ms | 3800 KB |
01_random_29.txt | AC | 5 ms | 3796 KB |
01_random_30.txt | AC | 5 ms | 3808 KB |
01_random_31.txt | AC | 5 ms | 3936 KB |
01_random_32.txt | AC | 5 ms | 3904 KB |