#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#include "stations.h"
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vector<vector<int>> adj(n);
for (int i = 0; i < n-1; i++) {
adj[u[i]].emplace_back(v[i]);
adj[v[i]].emplace_back(u[i]);
}
vector<int> tin(n);
int timer = 0;
auto dfs = [&](auto&& s, int v, int p) -> void {
tin[v] = timer++;
for (int u : adj[v]) if (u != p) {
s(s, u, v);
}
};
dfs(dfs, 0, -1);
return tin;
}
int find_next_station(int s, int t, std::vector<int> c) {
if (s > t) {
for (int x : c) if (x < s) return x;
}
else {
for (int i = 1; i < sz(c) + 1; i++) {
if (t < c[i+1]) return c[i];
}
return c.back();
}
assert(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
314 ms |
684 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
244 ms |
688 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
290 ms |
684 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
494 ms |
684 KB |
Output is correct |
2 |
Incorrect |
379 ms |
684 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
320 ms |
684 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |