#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int MAX_N=1010;
vector<vi> G;
int in[MAX_N],out[MAX_N];
int it;
void dfs(int u,int p){
in[u]=out[u]=it; it++;
for(auto &v:G[u]){
if(v!=p){
dfs(v,u);
out[u]=max(out[v],out[u]);
}
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
G.clear(); G.resize(n+1);
memset(in,0,sizeof in); memset(out,0,sizeof out);
it=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> lab;
for(int i=0;i<n;i++){
lab.push_back(out[i]*10000+in[i]);
}
return lab;
}
int find_next_station(int s, int t, std::vector<int> c) {
int pa=-1,hj=-1;
int lt,rt;
lt=t%10000;
rt=t/10000;
int ls,rs;
ls=s%10000;
rs=s/10000;
for(auto &v:c){
int l,r;
l=v%10000;
r=v/10000;
if(l<=ls && rs<=r){
pa=v;
continue;
}
if(l<=lt && rt<=r) hj=v;
}
//cout<<s<<" "<<t<<" "<<hj<<" "<<pa<<endl;
if(hj==-1) return pa;
return hj;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
424 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=90000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
404 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=9950000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
448 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=0, label=9960000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1470 ms |
400 KB |
Output is correct |
2 |
Correct |
1023 ms |
492 KB |
Output is correct |
3 |
Correct |
1109 ms |
400 KB |
Output is correct |
4 |
Correct |
3 ms |
464 KB |
Output is correct |
5 |
Correct |
6 ms |
468 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Correct |
634 ms |
400 KB |
Output is correct |
8 |
Correct |
1037 ms |
456 KB |
Output is correct |
9 |
Correct |
789 ms |
492 KB |
Output is correct |
10 |
Correct |
710 ms |
400 KB |
Output is correct |
11 |
Correct |
9 ms |
464 KB |
Output is correct |
12 |
Correct |
5 ms |
468 KB |
Output is correct |
13 |
Correct |
5 ms |
468 KB |
Output is correct |
14 |
Correct |
4 ms |
468 KB |
Output is correct |
15 |
Correct |
2 ms |
448 KB |
Output is correct |
16 |
Correct |
615 ms |
496 KB |
Output is correct |
17 |
Correct |
524 ms |
492 KB |
Output is correct |
18 |
Correct |
482 ms |
400 KB |
Output is correct |
19 |
Correct |
680 ms |
400 KB |
Output is correct |
20 |
Correct |
884 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
552 ms |
700 KB |
Partially correct |
2 |
Partially correct |
507 ms |
620 KB |
Partially correct |
3 |
Partially correct |
1069 ms |
400 KB |
Partially correct |
4 |
Partially correct |
703 ms |
572 KB |
Partially correct |
5 |
Partially correct |
782 ms |
492 KB |
Partially correct |
6 |
Partially correct |
655 ms |
608 KB |
Partially correct |
7 |
Partially correct |
641 ms |
528 KB |
Partially correct |
8 |
Partially correct |
3 ms |
468 KB |
Partially correct |
9 |
Partially correct |
4 ms |
468 KB |
Partially correct |
10 |
Partially correct |
2 ms |
468 KB |
Partially correct |
11 |
Partially correct |
437 ms |
604 KB |
Partially correct |
12 |
Partially correct |
725 ms |
484 KB |
Partially correct |
13 |
Partially correct |
1214 ms |
400 KB |
Partially correct |
14 |
Partially correct |
833 ms |
400 KB |
Partially correct |
15 |
Partially correct |
887 ms |
488 KB |
Partially correct |
16 |
Partially correct |
537 ms |
488 KB |
Partially correct |
17 |
Partially correct |
738 ms |
492 KB |
Partially correct |
18 |
Partially correct |
610 ms |
656 KB |
Partially correct |
19 |
Partially correct |
507 ms |
736 KB |
Partially correct |
20 |
Partially correct |
412 ms |
528 KB |
Partially correct |
21 |
Partially correct |
66 ms |
400 KB |
Partially correct |
22 |
Partially correct |
112 ms |
552 KB |
Partially correct |
23 |
Partially correct |
122 ms |
552 KB |
Partially correct |
24 |
Partially correct |
7 ms |
468 KB |
Partially correct |
25 |
Partially correct |
8 ms |
468 KB |
Partially correct |
26 |
Partially correct |
6 ms |
468 KB |
Partially correct |
27 |
Partially correct |
4 ms |
468 KB |
Partially correct |
28 |
Partially correct |
2 ms |
468 KB |
Partially correct |
29 |
Partially correct |
507 ms |
400 KB |
Partially correct |
30 |
Partially correct |
630 ms |
400 KB |
Partially correct |
31 |
Partially correct |
722 ms |
528 KB |
Partially correct |
32 |
Partially correct |
583 ms |
400 KB |
Partially correct |
33 |
Partially correct |
620 ms |
400 KB |
Partially correct |
34 |
Partially correct |
367 ms |
624 KB |
Partially correct |
35 |
Partially correct |
436 ms |
648 KB |
Partially correct |
36 |
Partially correct |
636 ms |
648 KB |
Partially correct |
37 |
Partially correct |
581 ms |
612 KB |
Partially correct |
38 |
Partially correct |
513 ms |
604 KB |
Partially correct |
39 |
Partially correct |
595 ms |
604 KB |
Partially correct |
40 |
Partially correct |
588 ms |
616 KB |
Partially correct |
41 |
Partially correct |
459 ms |
724 KB |
Partially correct |
42 |
Partially correct |
61 ms |
556 KB |
Partially correct |
43 |
Partially correct |
121 ms |
528 KB |
Partially correct |
44 |
Partially correct |
194 ms |
532 KB |
Partially correct |
45 |
Partially correct |
266 ms |
528 KB |
Partially correct |
46 |
Partially correct |
348 ms |
528 KB |
Partially correct |
47 |
Partially correct |
441 ms |
528 KB |
Partially correct |
48 |
Partially correct |
66 ms |
548 KB |
Partially correct |
49 |
Partially correct |
62 ms |
656 KB |
Partially correct |