#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;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;
}
}
//cout<<piv<<endl;
dfs(piv,piv);
vector<int> labels(n);
for(int i=0;i<n;i++){
//cout<<gg[i]<<" ";
labels[gg[i]]=i;
}
//cout<<endl;
return labels;
}
int find_next_station(int s, int t,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 |
Execution timed out |
3147 ms |
1202128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2993 ms |
2097152 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
966 ms |
656 KB |
Output is correct |
2 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |