#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
vector<int> g[n + 7];
for(int i = 0; i < n - 1; i++){
int x = u[i], y = v[i];
g[x].push_back(y);
g[y].push_back(x);
}
int st = 0;
for(int i = 1; i < n; i++){
if((int)g[i].size() < (int)g[st].size()){
st = i;
}
}
queue<int> q;
q.push(st);
vector<int> d(n + 7, 1e9);
while(!q.empty()){
int x = q.front();
q.pop();
for(auto y : g[x]){
if(d[y] == 1e9){
d[y] = d[x] + 1;
q.push(y);
}
}
}
for(int i = 0; i < n; i++){
labels[i] = d[i];
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
for(auto x : c){
if(s < t && x < s)return x;
if(s > t && x > s)return x;
}
return c[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
328 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1000000008 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
352 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1000000008 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
328 KB |
Invalid labels (values out of range). scenario=0, k=1000000, vertex=0, label=1000000002 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=0, label=1000000002 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
328 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=0, label=1000000002 |
2 |
Halted |
0 ms |
0 KB |
- |