#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++;
for (auto to : ed[cur]){
if (to != prev) {
cur = to;
break;
}
}
prev = cur;
if (prev == cur) break;
}
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 |
Incorrect |
3 ms |
328 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
336 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
328 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
260 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
268 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |