#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.assign(n, vector<int>(0));
ret.assign(n,-1);
for(int i = 0; i < n; ++i){
gri[u[i]].push_back(v[i]);
gri[v[i]].push_back(u[i]);
}
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(auto i : c)if(i == t)return i;
if(s < c[0]){
sort(c.begin(),c.end());
if(t < s)return c.back();
for(int i = 0; i < m-1; ++i){
if(c[i] > t)return c[i];
}
return c.back();
}
sort(c.rbegin(),c.rend());
if(s < t)return c.back();
for(int i = 0; i < m-1; ++i){
if(c[i] < t)return c[i];
}
return c.back();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3069 ms |
279404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
887 ms |
640 KB |
Output is correct |
2 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1748 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |