#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int MAX_N=1010;
vector<vi> G;
int out[MAX_N],mi[MAX_N];
int ite=0;
void dfs(int u,int p){
mi[u]=1e9;
for(auto &v:G[u]){
if(v!=p){
dfs(v,u);
mi[u]=min(mi[u],mi[v]);
}
}
out[u]=ite++;
mi[u]=min(mi[u],out[u]);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
ite=0;
G.clear();
G.resize(n+1);
for(int i=0;i<n-1;i++){
G[u[i]].push_back(v[i]);
G[v[i]].push_back(u[i]);
}
dfs(0,0);
vector<int> la;
for(int i=0;i<n;i++){
la.push_back(out[i]+(mi[i]*1000));
}
return la;
}
int find_next_station(int s, int t, std::vector<int> c) {
int pa=-1;
int lab=t%1000;
for(auto &v:c){
int l=v/1000;
int r=v%1000;
if(r>s%1000){
pa=v;
continue;
}
if(l<=lab && r>=lab){
return v;
}
}
return pa;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
416 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1004 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
280 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=2, label=511994 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
577 ms |
688 KB |
Output is correct |
2 |
Correct |
462 ms |
608 KB |
Output is correct |
3 |
Correct |
848 ms |
400 KB |
Output is correct |
4 |
Correct |
619 ms |
400 KB |
Output is correct |
5 |
Correct |
482 ms |
404 KB |
Output is correct |
6 |
Correct |
401 ms |
528 KB |
Output is correct |
7 |
Correct |
366 ms |
596 KB |
Output is correct |
8 |
Correct |
3 ms |
556 KB |
Output is correct |
9 |
Correct |
5 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
531 ms |
400 KB |
Output is correct |
12 |
Correct |
440 ms |
824 KB |
Output is correct |
13 |
Correct |
481 ms |
620 KB |
Output is correct |
14 |
Correct |
483 ms |
528 KB |
Output is correct |
15 |
Correct |
58 ms |
400 KB |
Output is correct |
16 |
Correct |
64 ms |
576 KB |
Output is correct |
17 |
Correct |
115 ms |
532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
702 ms |
404 KB |
Output is correct |
2 |
Correct |
625 ms |
400 KB |
Output is correct |
3 |
Correct |
602 ms |
472 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
3 ms |
476 KB |
Output is correct |
6 |
Correct |
1 ms |
464 KB |
Output is correct |
7 |
Correct |
512 ms |
488 KB |
Output is correct |
8 |
Correct |
805 ms |
496 KB |
Output is correct |
9 |
Correct |
720 ms |
620 KB |
Output is correct |
10 |
Correct |
428 ms |
520 KB |
Output is correct |
11 |
Correct |
2 ms |
468 KB |
Output is correct |
12 |
Correct |
4 ms |
480 KB |
Output is correct |
13 |
Correct |
3 ms |
476 KB |
Output is correct |
14 |
Correct |
4 ms |
476 KB |
Output is correct |
15 |
Correct |
1 ms |
476 KB |
Output is correct |
16 |
Correct |
541 ms |
488 KB |
Output is correct |
17 |
Correct |
505 ms |
400 KB |
Output is correct |
18 |
Correct |
476 ms |
496 KB |
Output is correct |
19 |
Correct |
473 ms |
492 KB |
Output is correct |
20 |
Correct |
523 ms |
400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
503 ms |
620 KB |
Partially correct |
2 |
Partially correct |
378 ms |
744 KB |
Partially correct |
3 |
Correct |
732 ms |
404 KB |
Output is correct |
4 |
Partially correct |
675 ms |
400 KB |
Partially correct |
5 |
Partially correct |
505 ms |
400 KB |
Partially correct |
6 |
Partially correct |
389 ms |
616 KB |
Partially correct |
7 |
Partially correct |
414 ms |
520 KB |
Partially correct |
8 |
Partially correct |
1 ms |
468 KB |
Partially correct |
9 |
Correct |
3 ms |
476 KB |
Output is correct |
10 |
Partially correct |
0 ms |
468 KB |
Partially correct |
11 |
Partially correct |
380 ms |
600 KB |
Partially correct |
12 |
Partially correct |
577 ms |
484 KB |
Partially correct |
13 |
Correct |
863 ms |
400 KB |
Output is correct |
14 |
Partially correct |
607 ms |
400 KB |
Partially correct |
15 |
Partially correct |
573 ms |
492 KB |
Partially correct |
16 |
Partially correct |
364 ms |
532 KB |
Partially correct |
17 |
Partially correct |
523 ms |
404 KB |
Partially correct |
18 |
Partially correct |
407 ms |
720 KB |
Partially correct |
19 |
Partially correct |
471 ms |
700 KB |
Partially correct |
20 |
Partially correct |
430 ms |
496 KB |
Partially correct |
21 |
Partially correct |
54 ms |
436 KB |
Partially correct |
22 |
Partially correct |
60 ms |
532 KB |
Partially correct |
23 |
Partially correct |
113 ms |
576 KB |
Partially correct |
24 |
Partially correct |
6 ms |
468 KB |
Partially correct |
25 |
Partially correct |
5 ms |
468 KB |
Partially correct |
26 |
Partially correct |
2 ms |
464 KB |
Partially correct |
27 |
Partially correct |
4 ms |
468 KB |
Partially correct |
28 |
Partially correct |
1 ms |
468 KB |
Partially correct |
29 |
Partially correct |
502 ms |
492 KB |
Partially correct |
30 |
Partially correct |
402 ms |
532 KB |
Partially correct |
31 |
Partially correct |
492 ms |
492 KB |
Partially correct |
32 |
Partially correct |
561 ms |
476 KB |
Partially correct |
33 |
Partially correct |
409 ms |
400 KB |
Partially correct |
34 |
Partially correct |
413 ms |
616 KB |
Partially correct |
35 |
Partially correct |
379 ms |
696 KB |
Partially correct |
36 |
Partially correct |
439 ms |
728 KB |
Partially correct |
37 |
Partially correct |
442 ms |
696 KB |
Partially correct |
38 |
Partially correct |
428 ms |
520 KB |
Partially correct |
39 |
Partially correct |
406 ms |
716 KB |
Partially correct |
40 |
Partially correct |
412 ms |
748 KB |
Partially correct |
41 |
Partially correct |
507 ms |
620 KB |
Partially correct |
42 |
Partially correct |
56 ms |
576 KB |
Partially correct |
43 |
Partially correct |
93 ms |
500 KB |
Partially correct |
44 |
Partially correct |
121 ms |
492 KB |
Partially correct |
45 |
Partially correct |
148 ms |
488 KB |
Partially correct |
46 |
Partially correct |
288 ms |
532 KB |
Partially correct |
47 |
Partially correct |
267 ms |
532 KB |
Partially correct |
48 |
Partially correct |
68 ms |
528 KB |
Partially correct |
49 |
Partially correct |
54 ms |
612 KB |
Partially correct |