# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
84737 | 2018-11-17T04:35:20 Z | kjh5678 | 두 로봇 (KOI18_robot) | C++14 | 94 ms | 31536 KB |
#if 01 #include <stdio.h> #define MAX(x,y) ((x>y)?(x):(y)) int N, r1, r2; typedef struct _idxarr { int node; int dist; _idxarr* next; _idxarr(){ node = dist = 0; next = (_idxarr*)0; }; _idxarr(int a, int b, _idxarr* c){ node = a; dist = b; next = c; } }ia; ia arr[100001]; int dist[100001]; int max[100001]; int visit[100001]; void input() { scanf("%d %d %d", &N, &r1, &r2); for (int i = 1; i <= N; i++) { int x, y, v; scanf("%d%d%d", &x, &y, &v); arr[x].next = new ia(y, v, arr[x].next); arr[y].next = new ia(x, v, arr[y].next); } } void DFS(int node, int d, int m) { dist[node] = d; max[node] = m; visit[node] = 1; for (ia* src = &arr[node]; src->next; src = src->next) { if (visit[src->next->node]) continue; DFS(src->next->node, d + src->next->dist, MAX(m, src->next->dist)); } } int main() { input(); DFS(r1, 0, 0); printf("%d", dist[r2] - max[r2]); } #endif
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 62 ms | 14072 KB | Output is correct |
2 | Correct | 61 ms | 15116 KB | Output is correct |
3 | Correct | 60 ms | 15612 KB | Output is correct |
4 | Correct | 4 ms | 15612 KB | Output is correct |
5 | Correct | 12 ms | 15612 KB | Output is correct |
6 | Correct | 12 ms | 15612 KB | Output is correct |
7 | Runtime error | 5 ms | 15612 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 81 ms | 17620 KB | Output is correct |
2 | Correct | 53 ms | 20500 KB | Output is correct |
3 | Correct | 5 ms | 20500 KB | Output is correct |
4 | Correct | 4 ms | 20500 KB | Output is correct |
5 | Correct | 13 ms | 20500 KB | Output is correct |
6 | Correct | 15 ms | 20500 KB | Output is correct |
7 | Runtime error | 6 ms | 20500 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 20500 KB | Output is correct |
2 | Correct | 4 ms | 20500 KB | Output is correct |
3 | Correct | 6 ms | 20500 KB | Output is correct |
4 | Runtime error | 7 ms | 20500 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 82 ms | 21060 KB | Output is correct |
2 | Correct | 84 ms | 22332 KB | Output is correct |
3 | Correct | 64 ms | 27028 KB | Output is correct |
4 | Correct | 53 ms | 27880 KB | Output is correct |
5 | Correct | 49 ms | 28300 KB | Output is correct |
6 | Correct | 94 ms | 31536 KB | Output is correct |
7 | Correct | 3 ms | 31536 KB | Output is correct |
8 | Correct | 3 ms | 31536 KB | Output is correct |
9 | Correct | 4 ms | 31536 KB | Output is correct |
10 | Correct | 10 ms | 31536 KB | Output is correct |
11 | Correct | 4 ms | 31536 KB | Output is correct |
12 | Correct | 12 ms | 31536 KB | Output is correct |
13 | Correct | 11 ms | 31536 KB | Output is correct |
14 | Correct | 10 ms | 31536 KB | Output is correct |
15 | Runtime error | 6 ms | 31536 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Halted | 0 ms | 0 KB | - |