#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> gri;
vector<int> ret;
int cn;
void dfs(int x, int p, int d){
if(!(d&1))ret[x] = cn++;
for(auto i : gri[x]){
if(i == p)continue;
dfs(i,x,d+1);
}
if(d&1)ret[x] = cn++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
cn = 0;
gri.resize(n);
for(int i = 0; i < n; ++i){
gri[u[i]].push_back(v[i]);
gri[v[i]].push_back(u[i]);
}
ret.resize(n,0);
dfs(0,0,0);
return ret;
}
int find_next_station(int s, int t, vector<int> c) {
int m = c.size();
if(m == 1)return c[0];
for(int i : c)if(i == t)return t;
if(s < c[0]){
sort(c.rbegin(),c.rend());
if(t < s)return c[0];
for(int i = 0; i < m; ++i){
if(c[i] > t)return c[i];
}
return c[0];
}
sort(c.begin(),c.end());
if(s < t)return c[0];
for(int i = 0; i < m; ++i){
if(c[i] < t)return c[i];
}
return c[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3063 ms |
3020 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1607 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 |
Correct |
835 ms |
904 KB |
Output is correct |
2 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1279 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |