#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
class pont{
public:
vector<int> v;
int be, ki;
bool volt = 0;
void dfs();
};
vector<pont> p;
int dd = -1;
void pont::dfs(){
if(!volt){
volt=1;
be=++dd;
for(int i : v){
p[i].dfs();
}
ki=++dd;
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
dd=-1;
p.clear();
p.resize(n);
for(int i=0;i<n-1;i++){
p[u[i]].v.push_back(v[i]);
p[v[i]].v.push_back(u[i]);
}
p[0].dfs();
vector<int> er(n);
for(int i=0;i<n;i++){
er[i] = p[i].be*2000+p[i].ki;
}
return er;
}
bool contains(int mi, int mit){
return mi/2000 <= mit/2000 && mit%2000 <= mi%2000;
}
int find_next_station(int s, int t, vector<int> c) {
if(contains(s,t)){
for(int i : c){
if(!contains(i,s) && contains(i,t)){
return i;
}
}
exit(255);
} else {
sort(c.begin(),c.end());
return c[0];
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=14014 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
512 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1991 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=3, label=1157149 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
952 ms |
640 KB |
Output is correct |
2 |
Correct |
743 ms |
640 KB |
Output is correct |
3 |
Correct |
617 ms |
648 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
888 KB |
Output is correct |
6 |
Correct |
1 ms |
640 KB |
Output is correct |
7 |
Correct |
650 ms |
784 KB |
Output is correct |
8 |
Correct |
997 ms |
648 KB |
Output is correct |
9 |
Correct |
695 ms |
640 KB |
Output is correct |
10 |
Correct |
650 ms |
640 KB |
Output is correct |
11 |
Correct |
7 ms |
640 KB |
Output is correct |
12 |
Correct |
7 ms |
640 KB |
Output is correct |
13 |
Correct |
5 ms |
640 KB |
Output is correct |
14 |
Correct |
5 ms |
640 KB |
Output is correct |
15 |
Correct |
2 ms |
648 KB |
Output is correct |
16 |
Correct |
516 ms |
860 KB |
Output is correct |
17 |
Correct |
533 ms |
768 KB |
Output is correct |
18 |
Correct |
678 ms |
644 KB |
Output is correct |
19 |
Correct |
568 ms |
744 KB |
Output is correct |
20 |
Correct |
568 ms |
752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
584 ms |
1024 KB |
Partially correct |
2 |
Partially correct |
512 ms |
1024 KB |
Partially correct |
3 |
Partially correct |
1025 ms |
648 KB |
Partially correct |
4 |
Partially correct |
672 ms |
640 KB |
Partially correct |
5 |
Partially correct |
809 ms |
896 KB |
Partially correct |
6 |
Partially correct |
495 ms |
1024 KB |
Partially correct |
7 |
Partially correct |
495 ms |
800 KB |
Partially correct |
8 |
Partially correct |
3 ms |
640 KB |
Partially correct |
9 |
Partially correct |
5 ms |
656 KB |
Partially correct |
10 |
Partially correct |
2 ms |
776 KB |
Partially correct |
11 |
Partially correct |
496 ms |
1116 KB |
Partially correct |
12 |
Partially correct |
564 ms |
1024 KB |
Partially correct |
13 |
Partially correct |
950 ms |
644 KB |
Partially correct |
14 |
Partially correct |
733 ms |
656 KB |
Partially correct |
15 |
Partially correct |
660 ms |
648 KB |
Partially correct |
16 |
Partially correct |
483 ms |
804 KB |
Partially correct |
17 |
Partially correct |
593 ms |
644 KB |
Partially correct |
18 |
Partially correct |
520 ms |
780 KB |
Partially correct |
19 |
Partially correct |
558 ms |
900 KB |
Partially correct |
20 |
Partially correct |
459 ms |
768 KB |
Partially correct |
21 |
Partially correct |
80 ms |
892 KB |
Partially correct |
22 |
Partially correct |
103 ms |
848 KB |
Partially correct |
23 |
Partially correct |
149 ms |
796 KB |
Partially correct |
24 |
Partially correct |
7 ms |
640 KB |
Partially correct |
25 |
Partially correct |
7 ms |
652 KB |
Partially correct |
26 |
Partially correct |
5 ms |
640 KB |
Partially correct |
27 |
Partially correct |
5 ms |
640 KB |
Partially correct |
28 |
Partially correct |
2 ms |
640 KB |
Partially correct |
29 |
Partially correct |
525 ms |
644 KB |
Partially correct |
30 |
Partially correct |
523 ms |
648 KB |
Partially correct |
31 |
Partially correct |
543 ms |
800 KB |
Partially correct |
32 |
Partially correct |
498 ms |
640 KB |
Partially correct |
33 |
Partially correct |
497 ms |
640 KB |
Partially correct |
34 |
Partially correct |
372 ms |
1016 KB |
Partially correct |
35 |
Partially correct |
447 ms |
768 KB |
Partially correct |
36 |
Partially correct |
507 ms |
1008 KB |
Partially correct |
37 |
Partially correct |
481 ms |
1024 KB |
Partially correct |
38 |
Partially correct |
476 ms |
1024 KB |
Partially correct |
39 |
Partially correct |
553 ms |
1024 KB |
Partially correct |
40 |
Partially correct |
492 ms |
1008 KB |
Partially correct |
41 |
Partially correct |
566 ms |
768 KB |
Partially correct |
42 |
Partially correct |
79 ms |
768 KB |
Partially correct |
43 |
Partially correct |
170 ms |
768 KB |
Partially correct |
44 |
Partially correct |
179 ms |
800 KB |
Partially correct |
45 |
Partially correct |
177 ms |
936 KB |
Partially correct |
46 |
Partially correct |
418 ms |
896 KB |
Partially correct |
47 |
Partially correct |
313 ms |
804 KB |
Partially correct |
48 |
Partially correct |
68 ms |
768 KB |
Partially correct |
49 |
Partially correct |
82 ms |
800 KB |
Partially correct |