#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;
}
}
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3136 ms |
1202360 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3002 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
844 ms |
776 KB |
Output is correct |
2 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |