#include <bits/stdc++.h>
#include "stations.h"
using namespace std;
const int MX = 1e3 + 5;
vector<int> L, adj[MX];
int O;
void dfs(int n, int p, int d) {
if (d&1) L[n]=O++;
for (auto &i:adj[n]) if (i!=p) dfs(i, n, d+1);
if (~d&1) L[n]=O++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
L.resize(n);
for (int i=0; i<n-1; i++)
adj[u[i]].emplace_back(v[i]),
adj[v[i]].emplace_back(u[i]);
dfs(1, 0, 1);
return L;
}
int find_next_station(int s, int t, vector<int> c) {
if (c.size()==1) return c[0];
if (c[0]>s) {
if (t<s||t>=c.back()) return c.back();
return *lower_bound(c.begin(), c.end(), t);
}
else {
if (t<=c[0]||t>s) return c[0];
return *--upper_bound(c.begin(), c.end(), t);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1250 ms |
2097152 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3040 ms |
624 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1395 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2244 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |