#include "stations.h"
#include <vector>
#define pb push_back
using namespace std;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
vector<int> ed[n];
for (int i = 0; i < n - 1; ++i) {
ed[u[i]].pb(v[i]);
ed[v[i]].pb(u[i]);
}
int prev = -1, cur = -1;
for (int i = 0; i < n; ++i) {
if (ed[i].size() == 1) cur = i;
}
int x = 0;
while (true){
labels[cur] = x++;
int a = -1;
for (auto to : ed[cur]){
if (to != prev) {
a = to;
break;
}
}
if (a == -1) break;
prev = cur;
cur = a;
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
if (s > t){
for (auto x : c){
if (s > x) return x;
}
}
else{
for (auto x : c){
if (s < x) return x;
}
}
return c[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
665 ms |
528 KB |
Output is correct |
2 |
Correct |
451 ms |
484 KB |
Output is correct |
3 |
Correct |
1053 ms |
400 KB |
Output is correct |
4 |
Correct |
788 ms |
400 KB |
Output is correct |
5 |
Correct |
621 ms |
404 KB |
Output is correct |
6 |
Correct |
471 ms |
528 KB |
Output is correct |
7 |
Correct |
545 ms |
484 KB |
Output is correct |
8 |
Correct |
3 ms |
472 KB |
Output is correct |
9 |
Correct |
4 ms |
484 KB |
Output is correct |
10 |
Correct |
2 ms |
480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
320 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
574 ms |
456 KB |
Output is correct |
2 |
Correct |
596 ms |
468 KB |
Output is correct |
3 |
Correct |
1037 ms |
400 KB |
Output is correct |
4 |
Correct |
779 ms |
528 KB |
Output is correct |
5 |
Correct |
654 ms |
568 KB |
Output is correct |
6 |
Correct |
559 ms |
476 KB |
Output is correct |
7 |
Correct |
516 ms |
480 KB |
Output is correct |
8 |
Correct |
2 ms |
472 KB |
Output is correct |
9 |
Correct |
4 ms |
472 KB |
Output is correct |
10 |
Correct |
2 ms |
472 KB |
Output is correct |
11 |
Incorrect |
1 ms |
200 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
937 ms |
464 KB |
Output is correct |
2 |
Correct |
857 ms |
480 KB |
Output is correct |
3 |
Correct |
819 ms |
476 KB |
Output is correct |
4 |
Correct |
2 ms |
472 KB |
Output is correct |
5 |
Correct |
5 ms |
472 KB |
Output is correct |
6 |
Correct |
2 ms |
472 KB |
Output is correct |
7 |
Incorrect |
1 ms |
284 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
533 ms |
532 KB |
Output is correct |
2 |
Correct |
550 ms |
528 KB |
Output is correct |
3 |
Correct |
879 ms |
400 KB |
Output is correct |
4 |
Correct |
853 ms |
400 KB |
Output is correct |
5 |
Correct |
816 ms |
400 KB |
Output is correct |
6 |
Correct |
526 ms |
536 KB |
Output is correct |
7 |
Correct |
590 ms |
528 KB |
Output is correct |
8 |
Correct |
3 ms |
480 KB |
Output is correct |
9 |
Correct |
6 ms |
472 KB |
Output is correct |
10 |
Correct |
2 ms |
488 KB |
Output is correct |
11 |
Incorrect |
5 ms |
268 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |