#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> edges[1005];
int dp[1005];
int mm, mx=-1;
void dfs(int u, int p=-1, int d=0){
dp[u] = d;
if(mx < d)mx=d,mm=u;
for(auto v:edges[u]){
if(v==p)continue;
dfs(v,u,d+1);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
for(int i=0;i<n-1;i++){
edges[u[i]].push_back(v[i]);
edges[v[i]].push_back(u[i]);
}
dfs(0);
dfs(mm);
vector<int> ans(n);
for(int i=0;i<n;i++)ans[i] = dp[i];
return ans;
}
/*
1
5 10
0 1
1 2
2 3
3 4
3
1 3 121
1 4 121
0 1 122
*/
int find_next_station(int s, int t, vector<int> c) {
if(s <= t)return s+1;
else return s-1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1561 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3036 ms |
488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1676 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
841 ms |
940 KB |
Output is correct |
2 |
Runtime error |
1287 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3144 ms |
2097156 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |