#include "stations.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<int(n);i++)
using namespace std;
typedef long long ll;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vector<vector<int>>E(n);
vector<int>deg(n);
rep(i,n-1){
E[u[i]].push_back(v[i]);
E[v[i]].push_back(u[i]);
deg[u[i]]++;
deg[v[i]]++;
}
int s=-1;
rep(i,n){
if(deg[i]==1){s=i;break;}
}
vector<int>vs;
vector<int>labels(n,-1);
rep(i,n){
vs.push_back(s);
labels[s]=i;
for(int u:E[s]){
if(labels[u]==-1){
s=u;break;
}
}
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
for(int u:c){
if((s-u>0)==(s-t>0))return u;
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
700 ms |
776 KB |
Output is correct |
2 |
Correct |
484 ms |
756 KB |
Output is correct |
3 |
Correct |
954 ms |
1356 KB |
Output is correct |
4 |
Correct |
695 ms |
868 KB |
Output is correct |
5 |
Correct |
685 ms |
996 KB |
Output is correct |
6 |
Correct |
580 ms |
736 KB |
Output is correct |
7 |
Correct |
639 ms |
784 KB |
Output is correct |
8 |
Correct |
3 ms |
868 KB |
Output is correct |
9 |
Correct |
5 ms |
996 KB |
Output is correct |
10 |
Correct |
2 ms |
756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
364 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=4, label=-1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
593 ms |
736 KB |
Output is correct |
2 |
Correct |
534 ms |
780 KB |
Output is correct |
3 |
Correct |
1065 ms |
868 KB |
Output is correct |
4 |
Correct |
652 ms |
792 KB |
Output is correct |
5 |
Correct |
635 ms |
868 KB |
Output is correct |
6 |
Correct |
470 ms |
756 KB |
Output is correct |
7 |
Correct |
423 ms |
756 KB |
Output is correct |
8 |
Correct |
3 ms |
736 KB |
Output is correct |
9 |
Correct |
5 ms |
1012 KB |
Output is correct |
10 |
Correct |
2 ms |
736 KB |
Output is correct |
11 |
Incorrect |
1 ms |
364 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=3, label=-1 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
902 ms |
744 KB |
Output is correct |
2 |
Correct |
704 ms |
868 KB |
Output is correct |
3 |
Correct |
603 ms |
1188 KB |
Output is correct |
4 |
Correct |
3 ms |
876 KB |
Output is correct |
5 |
Correct |
5 ms |
756 KB |
Output is correct |
6 |
Correct |
2 ms |
796 KB |
Output is correct |
7 |
Incorrect |
1 ms |
364 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=2, label=-1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
529 ms |
780 KB |
Output is correct |
2 |
Correct |
448 ms |
780 KB |
Output is correct |
3 |
Correct |
1031 ms |
736 KB |
Output is correct |
4 |
Correct |
687 ms |
868 KB |
Output is correct |
5 |
Correct |
641 ms |
868 KB |
Output is correct |
6 |
Correct |
507 ms |
736 KB |
Output is correct |
7 |
Correct |
537 ms |
736 KB |
Output is correct |
8 |
Correct |
3 ms |
876 KB |
Output is correct |
9 |
Correct |
7 ms |
736 KB |
Output is correct |
10 |
Correct |
2 ms |
868 KB |
Output is correct |
11 |
Incorrect |
6 ms |
364 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=4, label=-1 |
12 |
Halted |
0 ms |
0 KB |
- |