#include <iostream>
#include <vector>
#include <algorithm>
#include "stations.h"
using namespace std;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<vector<int>> adj(n, vector<int>(0));
for (int i = 0; i < n - 1; i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
vector<int> in(n, 0);
int idx = 0;
function<void(int, int)> dfs = [&] (int curr, int par) {
in[curr] = idx++;
for (int i : adj[curr]) {
dfs(i, curr);
}
};
dfs(0, -1);
return in;
}
int find_next_station(int s, int t, vector<int> c) {
for (int i : c) {
if (i == t) return i;
if (i >= min(s, t) && i <= max(s, t)) return i;
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2945 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1374 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1271 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1360 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1263 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |