#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int X = 1005;
vector<int> ed[X];
bool lv[X];
int num;
void dfs(int u, int p, vector<int> &lb){
lv[u] = !lv[p];
if(lv[u]) lb[u] = num++;
for(int v: ed[u]) if(v != p) dfs(v, u, lb);
if(!lv[u]) lb[u] = num++;
}
vector<int> label(int N, int K, vector<int> ar1, vector<int> ar2) {
vector<int> lb(N);
for(int i = 0; i < N - 1; ++i) ed[ar1[i]].emplace_back(ar2[i]), ed[ar2[i]].emplace_back(ar1[i]);
dfs(0, 0, lb);
return lb;
}
int find_next_station(int s, int t, vector<int> c) {
if(c.size() == 1) return c[0];
sort(c.begin(), c.end());
if(c[0] < s){
if(t < c[1] or t > s) return c[0];
return *(upper_bound(c.begin(), c.end(), t) - 1);
} else {
if(t > c[c.size() - 2] or t < s) return c.back();
return *lower_bound(c.begin(), c.end(), t);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1715 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
748 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1481 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
819 ms |
952 KB |
Output is correct |
2 |
Runtime error |
1184 ms |
2097156 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2572 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |