#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int Mx = 1001;
vector<int> labels;
vector<int> tr[Mx];
void dfs(int node,int par){
for(auto i:tr[node]){
if(i != par){
labels[i] = labels[node]+1;
dfs(i,node);
}
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
labels.assign(n,0);
for (int i = 0; i < n-1; i++) {
tr[u[i]].push_back(v[i]);
tr[v[i]].push_back(u[i]);
}
for(int i=0;i<n;i++){
if(tr[i].size() == 1){
dfs(i,i);
break;
}
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
int ans = -1;
if(t > s){
for(auto i:c){
ans = max(ans,i);
}
}else{
ans = 1e9+7;
for(auto i:c){
ans = min(ans,i);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1642 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3048 ms |
320 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1555 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2856 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |