#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>>graf;
vector<int>visit;
vector<pair<int,int>>beki;
void dfs(int v,int &ido){
visit[v]=1;
beki[v].first=ido;
ido++;
for(int i:graf[v]){
if(!visit[i]){
dfs(i,ido);
}
}
beki[v].second=ido;
ido++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
graf.clear();
visit.clear();
beki.clear();
graf.resize(n);
visit.resize(n,0);
beki.resize(n);
int ido=0;
for (int i = 0; i < n-1; i++) {
graf[u[i]].push_back(v[i]);
graf[v[i]].push_back(u[i]);
}
dfs(0,ido);
for(int i=0;i<n;i++){
labels[i]=beki[i].first*2000+beki[i].second;
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
pair<long long, long long>kezdo;
pair<long long, long long>cel;
kezdo.first=s/2000;
kezdo.second=s%2000;
cel.first=t/2000;
cel.second=t%2000;
int ki=c[0];
if(kezdo.first<cel.first && kezdo.second>cel.second){ //else jo a c[0]
for(unsigned long long i=1;i<c.size();i++){
int cf=c[i]/2000,cs=c[i]%2000;
if(cf<=cel.first && cs>=cel.second){
ki=c[i];
break;
}
}
}
return ki;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
384 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1991 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
934 ms |
652 KB |
Output is correct |
2 |
Correct |
981 ms |
640 KB |
Output is correct |
3 |
Correct |
703 ms |
640 KB |
Output is correct |
4 |
Correct |
4 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
1 ms |
644 KB |
Output is correct |
7 |
Correct |
600 ms |
640 KB |
Output is correct |
8 |
Correct |
1359 ms |
672 KB |
Output is correct |
9 |
Correct |
755 ms |
760 KB |
Output is correct |
10 |
Correct |
767 ms |
800 KB |
Output is correct |
11 |
Correct |
5 ms |
640 KB |
Output is correct |
12 |
Correct |
4 ms |
652 KB |
Output is correct |
13 |
Correct |
5 ms |
640 KB |
Output is correct |
14 |
Correct |
5 ms |
648 KB |
Output is correct |
15 |
Correct |
2 ms |
640 KB |
Output is correct |
16 |
Correct |
650 ms |
788 KB |
Output is correct |
17 |
Correct |
600 ms |
640 KB |
Output is correct |
18 |
Correct |
728 ms |
656 KB |
Output is correct |
19 |
Correct |
670 ms |
640 KB |
Output is correct |
20 |
Correct |
675 ms |
640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
599 ms |
1008 KB |
Partially correct |
2 |
Partially correct |
552 ms |
768 KB |
Partially correct |
3 |
Partially correct |
1033 ms |
616 KB |
Partially correct |
4 |
Partially correct |
899 ms |
640 KB |
Partially correct |
5 |
Partially correct |
652 ms |
652 KB |
Partially correct |
6 |
Partially correct |
534 ms |
776 KB |
Partially correct |
7 |
Partially correct |
469 ms |
792 KB |
Partially correct |
8 |
Partially correct |
3 ms |
656 KB |
Partially correct |
9 |
Partially correct |
6 ms |
640 KB |
Partially correct |
10 |
Partially correct |
2 ms |
640 KB |
Partially correct |
11 |
Partially correct |
604 ms |
816 KB |
Partially correct |
12 |
Partially correct |
522 ms |
948 KB |
Partially correct |
13 |
Partially correct |
1202 ms |
644 KB |
Partially correct |
14 |
Partially correct |
671 ms |
648 KB |
Partially correct |
15 |
Partially correct |
663 ms |
648 KB |
Partially correct |
16 |
Partially correct |
475 ms |
768 KB |
Partially correct |
17 |
Partially correct |
586 ms |
652 KB |
Partially correct |
18 |
Partially correct |
538 ms |
768 KB |
Partially correct |
19 |
Partially correct |
566 ms |
1016 KB |
Partially correct |
20 |
Partially correct |
511 ms |
812 KB |
Partially correct |
21 |
Partially correct |
80 ms |
892 KB |
Partially correct |
22 |
Partially correct |
73 ms |
848 KB |
Partially correct |
23 |
Partially correct |
125 ms |
804 KB |
Partially correct |
24 |
Partially correct |
7 ms |
648 KB |
Partially correct |
25 |
Partially correct |
7 ms |
640 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 |
509 ms |
648 KB |
Partially correct |
30 |
Partially correct |
541 ms |
744 KB |
Partially correct |
31 |
Partially correct |
599 ms |
676 KB |
Partially correct |
32 |
Partially correct |
672 ms |
744 KB |
Partially correct |
33 |
Partially correct |
636 ms |
768 KB |
Partially correct |
34 |
Partially correct |
341 ms |
1008 KB |
Partially correct |
35 |
Partially correct |
602 ms |
1024 KB |
Partially correct |
36 |
Partially correct |
560 ms |
1024 KB |
Partially correct |
37 |
Partially correct |
603 ms |
896 KB |
Partially correct |
38 |
Partially correct |
565 ms |
992 KB |
Partially correct |
39 |
Partially correct |
553 ms |
1248 KB |
Partially correct |
40 |
Partially correct |
527 ms |
1008 KB |
Partially correct |
41 |
Partially correct |
570 ms |
844 KB |
Partially correct |
42 |
Partially correct |
85 ms |
768 KB |
Partially correct |
43 |
Partially correct |
135 ms |
768 KB |
Partially correct |
44 |
Partially correct |
177 ms |
920 KB |
Partially correct |
45 |
Partially correct |
219 ms |
952 KB |
Partially correct |
46 |
Partially correct |
362 ms |
896 KB |
Partially correct |
47 |
Partially correct |
451 ms |
756 KB |
Partially correct |
48 |
Partially correct |
76 ms |
768 KB |
Partially correct |
49 |
Partially correct |
81 ms |
776 KB |
Partially correct |