#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
vector<int> adj[1005];
vector<int> ans;
int cnt = 0;
int S[1005], E[1005];
void dfs(int x, int p){
S[x] = cnt++;
for(auto i : adj[x])if(i != p)dfs(i, x);
E[x] = cnt - 1;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for(int i=0;i<n;i++)adj[i].clear();
for(int i=0;i<n-1;i++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
cnt = 0;
dfs(0, -1);
ans.resize(n);
for(int i=0;i<n;i++)ans[i] = S[i] * 1000 + E[i] - S[i];
return ans;
}
int find_next_station(int s, int t, std::vector<int> c) {
int st = s/1000, en = s % 1000;
en += st;
int st2 = t / 1000, en2 = t % 1000;
en2 += st2;
int lab = 0;
for(auto i : c){
int tmp = i / 1000, tmp2 = i % 1000;
tmp2 += tmp;
if(tmp <= st2 && tmp2 >= en2 && tmp >= st)return i;
if(tmp < st)lab = i;
}
return lab;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6003 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
324 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1510 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
536 ms |
632 KB |
Output is correct |
2 |
Correct |
489 ms |
544 KB |
Output is correct |
3 |
Correct |
805 ms |
524 KB |
Output is correct |
4 |
Correct |
669 ms |
532 KB |
Output is correct |
5 |
Correct |
646 ms |
528 KB |
Output is correct |
6 |
Correct |
492 ms |
644 KB |
Output is correct |
7 |
Correct |
424 ms |
544 KB |
Output is correct |
8 |
Correct |
1 ms |
492 KB |
Output is correct |
9 |
Correct |
4 ms |
500 KB |
Output is correct |
10 |
Correct |
1 ms |
488 KB |
Output is correct |
11 |
Correct |
586 ms |
416 KB |
Output is correct |
12 |
Correct |
399 ms |
532 KB |
Output is correct |
13 |
Correct |
424 ms |
744 KB |
Output is correct |
14 |
Correct |
381 ms |
548 KB |
Output is correct |
15 |
Correct |
53 ms |
600 KB |
Output is correct |
16 |
Correct |
63 ms |
668 KB |
Output is correct |
17 |
Correct |
110 ms |
684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
874 ms |
520 KB |
Output is correct |
2 |
Correct |
652 ms |
416 KB |
Output is correct |
3 |
Correct |
578 ms |
532 KB |
Output is correct |
4 |
Correct |
3 ms |
500 KB |
Output is correct |
5 |
Correct |
6 ms |
492 KB |
Output is correct |
6 |
Correct |
1 ms |
492 KB |
Output is correct |
7 |
Correct |
567 ms |
420 KB |
Output is correct |
8 |
Correct |
855 ms |
420 KB |
Output is correct |
9 |
Correct |
682 ms |
420 KB |
Output is correct |
10 |
Correct |
619 ms |
416 KB |
Output is correct |
11 |
Correct |
7 ms |
632 KB |
Output is correct |
12 |
Correct |
5 ms |
620 KB |
Output is correct |
13 |
Correct |
3 ms |
492 KB |
Output is correct |
14 |
Correct |
4 ms |
492 KB |
Output is correct |
15 |
Correct |
1 ms |
500 KB |
Output is correct |
16 |
Correct |
610 ms |
484 KB |
Output is correct |
17 |
Correct |
504 ms |
420 KB |
Output is correct |
18 |
Correct |
567 ms |
532 KB |
Output is correct |
19 |
Correct |
477 ms |
532 KB |
Output is correct |
20 |
Correct |
505 ms |
532 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
599 ms |
544 KB |
Partially correct |
2 |
Partially correct |
437 ms |
620 KB |
Partially correct |
3 |
Correct |
864 ms |
516 KB |
Output is correct |
4 |
Partially correct |
614 ms |
532 KB |
Partially correct |
5 |
Partially correct |
543 ms |
532 KB |
Partially correct |
6 |
Partially correct |
425 ms |
536 KB |
Partially correct |
7 |
Partially correct |
404 ms |
528 KB |
Partially correct |
8 |
Partially correct |
2 ms |
492 KB |
Partially correct |
9 |
Partially correct |
5 ms |
492 KB |
Partially correct |
10 |
Partially correct |
1 ms |
488 KB |
Partially correct |
11 |
Partially correct |
523 ms |
600 KB |
Partially correct |
12 |
Partially correct |
558 ms |
536 KB |
Partially correct |
13 |
Correct |
916 ms |
416 KB |
Output is correct |
14 |
Partially correct |
567 ms |
532 KB |
Partially correct |
15 |
Partially correct |
612 ms |
532 KB |
Partially correct |
16 |
Partially correct |
491 ms |
524 KB |
Partially correct |
17 |
Partially correct |
629 ms |
548 KB |
Partially correct |
18 |
Partially correct |
492 ms |
644 KB |
Partially correct |
19 |
Partially correct |
518 ms |
544 KB |
Partially correct |
20 |
Partially correct |
506 ms |
508 KB |
Partially correct |
21 |
Partially correct |
59 ms |
620 KB |
Partially correct |
22 |
Partially correct |
72 ms |
552 KB |
Partially correct |
23 |
Partially correct |
118 ms |
560 KB |
Partially correct |
24 |
Partially correct |
6 ms |
628 KB |
Partially correct |
25 |
Partially correct |
5 ms |
492 KB |
Partially correct |
26 |
Partially correct |
5 ms |
492 KB |
Partially correct |
27 |
Partially correct |
2 ms |
500 KB |
Partially correct |
28 |
Partially correct |
2 ms |
492 KB |
Partially correct |
29 |
Partially correct |
439 ms |
416 KB |
Partially correct |
30 |
Partially correct |
440 ms |
532 KB |
Partially correct |
31 |
Partially correct |
434 ms |
420 KB |
Partially correct |
32 |
Partially correct |
446 ms |
420 KB |
Partially correct |
33 |
Partially correct |
478 ms |
544 KB |
Partially correct |
34 |
Partially correct |
282 ms |
544 KB |
Partially correct |
35 |
Partially correct |
439 ms |
668 KB |
Partially correct |
36 |
Partially correct |
447 ms |
640 KB |
Partially correct |
37 |
Partially correct |
432 ms |
544 KB |
Partially correct |
38 |
Partially correct |
458 ms |
720 KB |
Partially correct |
39 |
Partially correct |
437 ms |
640 KB |
Partially correct |
40 |
Partially correct |
455 ms |
780 KB |
Partially correct |
41 |
Partially correct |
418 ms |
664 KB |
Partially correct |
42 |
Partially correct |
51 ms |
672 KB |
Partially correct |
43 |
Partially correct |
113 ms |
540 KB |
Partially correct |
44 |
Partially correct |
99 ms |
616 KB |
Partially correct |
45 |
Partially correct |
157 ms |
528 KB |
Partially correct |
46 |
Partially correct |
323 ms |
548 KB |
Partially correct |
47 |
Partially correct |
334 ms |
544 KB |
Partially correct |
48 |
Partially correct |
51 ms |
784 KB |
Partially correct |
49 |
Partially correct |
61 ms |
676 KB |
Partially correct |