#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
vector<int> g[N];
int t = 0;
vector<int> l;
int dfs(int v, int p = -1) {
l[v] = t++;
int mx = l[v];
for (int u : g[v]) {
if (u != p) mx = max(mx, dfs(u, v));
}
l[v] *= N;
l[v] += mx;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
for (int i = 0; i < n; i++) g[i].clear();
for (int i = 0; i < n - 1; i++) {
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
l.resize(n);
dfs(0);
return l;
}
int find_next_station(int s, int t, vector<int> c) {
int p = -1;
for (int v : c) {
if (v / N <= s / N && s / N <= v % N) p = v; else {
if (v / N <= t / N && t / N <= v % N) return v;
}
}
assert(~p);
return p;
}
#ifdef LOCAL
int main(){
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
return 0;
}
#endif
Compilation message
stations.cpp: In function 'int dfs(int, int)':
stations.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
18 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
620 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
652 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
620 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |