#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int nax = 1000;
vector<int>g[nax];
vector<int> labels;
int _tm;
void dfs(int v, int p = -1) {
labels[v] = _tm++;
for(int u : g[v]) if(u!=p) {
dfs(u, v);
}
labels[v] |= (_tm-1)<<10;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
labels.resize(n);
for(int i=0; i<n; ++i) g[i].clear();
for(int i=0; i<n-1; ++i) {
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
_tm = 1;
dfs(0);
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
int m = c.size();
vector<pair<int,int>>rng(m);
for(int i=0; i<m; ++i) {
rng[i].first = (((1<<10)-1)&c[i]);
rng[i].second = (c[i] >> 10);
}
sort(rng.begin(), rng.end());
t = (((1<<10)-1)&t);
for(int i=1; i<m; ++i) {
if(t >= rng[i].first && t <= rng[i].second) {
return rng[i].first + (rng[i].second << 10);
}
}
return rng[0].first + (rng[0].second << 10);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=10241 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
316 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1019905 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
420 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=0, label=1020929 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
686 ms |
528 KB |
Output is correct |
2 |
Correct |
598 ms |
416 KB |
Output is correct |
3 |
Correct |
456 ms |
528 KB |
Output is correct |
4 |
Correct |
1 ms |
492 KB |
Output is correct |
5 |
Correct |
3 ms |
512 KB |
Output is correct |
6 |
Correct |
0 ms |
492 KB |
Output is correct |
7 |
Correct |
476 ms |
416 KB |
Output is correct |
8 |
Correct |
638 ms |
532 KB |
Output is correct |
9 |
Correct |
506 ms |
528 KB |
Output is correct |
10 |
Correct |
436 ms |
416 KB |
Output is correct |
11 |
Correct |
4 ms |
492 KB |
Output is correct |
12 |
Correct |
4 ms |
492 KB |
Output is correct |
13 |
Correct |
4 ms |
492 KB |
Output is correct |
14 |
Correct |
2 ms |
500 KB |
Output is correct |
15 |
Correct |
1 ms |
492 KB |
Output is correct |
16 |
Correct |
365 ms |
532 KB |
Output is correct |
17 |
Correct |
373 ms |
520 KB |
Output is correct |
18 |
Correct |
382 ms |
528 KB |
Output is correct |
19 |
Correct |
364 ms |
528 KB |
Output is correct |
20 |
Correct |
412 ms |
528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
396 ms |
524 KB |
Partially correct |
2 |
Partially correct |
449 ms |
536 KB |
Partially correct |
3 |
Partially correct |
567 ms |
420 KB |
Partially correct |
4 |
Partially correct |
508 ms |
528 KB |
Partially correct |
5 |
Partially correct |
475 ms |
528 KB |
Partially correct |
6 |
Partially correct |
308 ms |
548 KB |
Partially correct |
7 |
Partially correct |
416 ms |
532 KB |
Partially correct |
8 |
Partially correct |
1 ms |
564 KB |
Partially correct |
9 |
Partially correct |
2 ms |
440 KB |
Partially correct |
10 |
Partially correct |
1 ms |
492 KB |
Partially correct |
11 |
Partially correct |
365 ms |
596 KB |
Partially correct |
12 |
Partially correct |
378 ms |
572 KB |
Partially correct |
13 |
Partially correct |
607 ms |
596 KB |
Partially correct |
14 |
Partially correct |
419 ms |
536 KB |
Partially correct |
15 |
Partially correct |
524 ms |
528 KB |
Partially correct |
16 |
Partially correct |
302 ms |
532 KB |
Partially correct |
17 |
Partially correct |
452 ms |
528 KB |
Partially correct |
18 |
Partially correct |
428 ms |
632 KB |
Partially correct |
19 |
Partially correct |
419 ms |
716 KB |
Partially correct |
20 |
Partially correct |
271 ms |
548 KB |
Partially correct |
21 |
Partially correct |
59 ms |
492 KB |
Partially correct |
22 |
Partially correct |
56 ms |
672 KB |
Partially correct |
23 |
Partially correct |
99 ms |
704 KB |
Partially correct |
24 |
Partially correct |
5 ms |
488 KB |
Partially correct |
25 |
Partially correct |
5 ms |
556 KB |
Partially correct |
26 |
Partially correct |
1 ms |
492 KB |
Partially correct |
27 |
Partially correct |
4 ms |
492 KB |
Partially correct |
28 |
Partially correct |
1 ms |
492 KB |
Partially correct |
29 |
Partially correct |
504 ms |
532 KB |
Partially correct |
30 |
Partially correct |
427 ms |
484 KB |
Partially correct |
31 |
Partially correct |
362 ms |
592 KB |
Partially correct |
32 |
Partially correct |
502 ms |
468 KB |
Partially correct |
33 |
Partially correct |
477 ms |
524 KB |
Partially correct |
34 |
Partially correct |
255 ms |
624 KB |
Partially correct |
35 |
Partially correct |
424 ms |
796 KB |
Partially correct |
36 |
Partially correct |
371 ms |
688 KB |
Partially correct |
37 |
Partially correct |
352 ms |
756 KB |
Partially correct |
38 |
Partially correct |
430 ms |
648 KB |
Partially correct |
39 |
Partially correct |
340 ms |
636 KB |
Partially correct |
40 |
Partially correct |
470 ms |
768 KB |
Partially correct |
41 |
Partially correct |
392 ms |
644 KB |
Partially correct |
42 |
Partially correct |
59 ms |
544 KB |
Partially correct |
43 |
Partially correct |
101 ms |
740 KB |
Partially correct |
44 |
Partially correct |
136 ms |
620 KB |
Partially correct |
45 |
Partially correct |
147 ms |
544 KB |
Partially correct |
46 |
Partially correct |
252 ms |
624 KB |
Partially correct |
47 |
Partially correct |
281 ms |
548 KB |
Partially correct |
48 |
Partially correct |
70 ms |
756 KB |
Partially correct |
49 |
Partially correct |
47 ms |
704 KB |
Partially correct |