#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 = 1;
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 |
332 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 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 |
3 ms |
328 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1134 ms |
456 KB |
Output is correct |
2 |
Incorrect |
1 ms |
276 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
3 |
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 |
- |