#include "stations.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
vector<vector<int>> G;
vector<int> gg;
void dfs(int node,int pad){
gg.push_back(node);
for(auto i:G[node]){
if(i==pad)continue;
dfs(i,node);
}
}
vector<int> label(int n, int k,vector<int> u,vector<int> v) {
G.clear();
G.assign(n+1,vector<int>());
for(int i=0;i<n-1;i++){
G[u[i]].push_back(v[i]);
G[v[i]].push_back(u[i]);
}
int piv=0;
for(int i=0;i<n;i++){
if(G[i].size()==1){
piv=i;
break;
}
}
dfs(piv,piv);
vector<int> labels(n);
for(int i=0;i<n;i++){
labels[gg[i]]=i;
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(t<s)return s-1;
else return s+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
504 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
760 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
982 ms |
640 KB |
Output is correct |
2 |
Incorrect |
671 ms |
656 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |