#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1011;
vector<int> g[MAXN];
int tin[MAXN], last[MAXN], timer = 0;
void dfs(int v, int p){
tin[v] = last[v] = timer++;
for (int u : g[v]){
if (u != p){
dfs(u, v);
last[v] = last[u];
}
}
}
vector<int> label(int n, int k, vector<int> U, vector<int> V) {
for (int i = 0; i < n; i++) g[i].clear();
timer = 0;
for (int i = 0; i < n - 1; i++){
g[U[i]].push_back(V[i]);
g[V[i]].push_back(U[i]);
}
dfs(0, -1);
vector<int> labels(n, 0);
for (int i = 0; i < n; i++){
labels[i] = tin[i] * 1000 + last[i];
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
int ans = c[0];
t /= 1000;
for (int v : c){
int x = v / 1000, y = v % 1000;
if (x <= t && t <= y) ans = v;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
320 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
320 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
726 ms |
532 KB |
Output is correct |
2 |
Correct |
471 ms |
624 KB |
Output is correct |
3 |
Correct |
1214 ms |
652 KB |
Output is correct |
4 |
Correct |
868 ms |
528 KB |
Output is correct |
5 |
Correct |
831 ms |
528 KB |
Output is correct |
6 |
Correct |
496 ms |
520 KB |
Output is correct |
7 |
Correct |
514 ms |
528 KB |
Output is correct |
8 |
Correct |
3 ms |
480 KB |
Output is correct |
9 |
Correct |
4 ms |
472 KB |
Output is correct |
10 |
Correct |
2 ms |
548 KB |
Output is correct |
11 |
Correct |
665 ms |
520 KB |
Output is correct |
12 |
Correct |
514 ms |
748 KB |
Output is correct |
13 |
Correct |
526 ms |
692 KB |
Output is correct |
14 |
Correct |
620 ms |
524 KB |
Output is correct |
15 |
Correct |
56 ms |
528 KB |
Output is correct |
16 |
Correct |
72 ms |
672 KB |
Output is correct |
17 |
Correct |
132 ms |
660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1007 ms |
400 KB |
Output is correct |
2 |
Correct |
884 ms |
400 KB |
Output is correct |
3 |
Correct |
739 ms |
520 KB |
Output is correct |
4 |
Correct |
3 ms |
480 KB |
Output is correct |
5 |
Correct |
5 ms |
472 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
659 ms |
520 KB |
Output is correct |
8 |
Correct |
1003 ms |
528 KB |
Output is correct |
9 |
Correct |
620 ms |
520 KB |
Output is correct |
10 |
Correct |
668 ms |
400 KB |
Output is correct |
11 |
Correct |
7 ms |
608 KB |
Output is correct |
12 |
Correct |
7 ms |
600 KB |
Output is correct |
13 |
Correct |
7 ms |
472 KB |
Output is correct |
14 |
Correct |
5 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
600 KB |
Output is correct |
16 |
Correct |
683 ms |
528 KB |
Output is correct |
17 |
Correct |
610 ms |
580 KB |
Output is correct |
18 |
Correct |
586 ms |
516 KB |
Output is correct |
19 |
Correct |
628 ms |
528 KB |
Output is correct |
20 |
Correct |
485 ms |
516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
673 ms |
520 KB |
Partially correct |
2 |
Partially correct |
470 ms |
600 KB |
Partially correct |
3 |
Partially correct |
876 ms |
656 KB |
Partially correct |
4 |
Partially correct |
889 ms |
404 KB |
Partially correct |
5 |
Partially correct |
744 ms |
532 KB |
Partially correct |
6 |
Partially correct |
506 ms |
656 KB |
Partially correct |
7 |
Partially correct |
581 ms |
532 KB |
Partially correct |
8 |
Partially correct |
3 ms |
600 KB |
Partially correct |
9 |
Partially correct |
4 ms |
472 KB |
Partially correct |
10 |
Partially correct |
2 ms |
480 KB |
Partially correct |
11 |
Partially correct |
543 ms |
584 KB |
Partially correct |
12 |
Partially correct |
556 ms |
528 KB |
Partially correct |
13 |
Partially correct |
1126 ms |
528 KB |
Partially correct |
14 |
Partially correct |
829 ms |
528 KB |
Partially correct |
15 |
Partially correct |
694 ms |
528 KB |
Partially correct |
16 |
Partially correct |
608 ms |
656 KB |
Partially correct |
17 |
Partially correct |
632 ms |
528 KB |
Partially correct |
18 |
Partially correct |
549 ms |
528 KB |
Partially correct |
19 |
Partially correct |
614 ms |
640 KB |
Partially correct |
20 |
Partially correct |
560 ms |
656 KB |
Partially correct |
21 |
Partially correct |
85 ms |
536 KB |
Partially correct |
22 |
Partially correct |
78 ms |
512 KB |
Partially correct |
23 |
Partially correct |
162 ms |
656 KB |
Partially correct |
24 |
Partially correct |
7 ms |
604 KB |
Partially correct |
25 |
Partially correct |
7 ms |
420 KB |
Partially correct |
26 |
Partially correct |
6 ms |
468 KB |
Partially correct |
27 |
Partially correct |
5 ms |
548 KB |
Partially correct |
28 |
Partially correct |
2 ms |
552 KB |
Partially correct |
29 |
Partially correct |
606 ms |
520 KB |
Partially correct |
30 |
Partially correct |
640 ms |
528 KB |
Partially correct |
31 |
Partially correct |
576 ms |
524 KB |
Partially correct |
32 |
Partially correct |
620 ms |
528 KB |
Partially correct |
33 |
Partially correct |
465 ms |
528 KB |
Partially correct |
34 |
Partially correct |
423 ms |
648 KB |
Partially correct |
35 |
Partially correct |
626 ms |
624 KB |
Partially correct |
36 |
Partially correct |
590 ms |
632 KB |
Partially correct |
37 |
Partially correct |
597 ms |
680 KB |
Partially correct |
38 |
Partially correct |
611 ms |
788 KB |
Partially correct |
39 |
Partially correct |
628 ms |
628 KB |
Partially correct |
40 |
Partially correct |
599 ms |
760 KB |
Partially correct |
41 |
Partially correct |
576 ms |
772 KB |
Partially correct |
42 |
Partially correct |
83 ms |
656 KB |
Partially correct |
43 |
Partially correct |
147 ms |
652 KB |
Partially correct |
44 |
Partially correct |
157 ms |
528 KB |
Partially correct |
45 |
Partially correct |
228 ms |
532 KB |
Partially correct |
46 |
Partially correct |
394 ms |
656 KB |
Partially correct |
47 |
Partially correct |
383 ms |
516 KB |
Partially correct |
48 |
Partially correct |
71 ms |
656 KB |
Partially correct |
49 |
Partially correct |
80 ms |
676 KB |
Partially correct |