#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> g[1000], tin;
int timer = 0;
void dfs(int u, int p, int d){
if(!d) tin[u] = timer++;
for(int v : g[u]) if(v != p){
dfs(v, u, d ^ 1);
}
if(d) tin[u] = timer++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v){
for(int i = 0; i < n - 1; i++){
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
tin.resize(n);
dfs(0, 0, 0);
return tin;
}
int find_next_station(int s, int t, vector<int> c){
int m = c.size(), i;
if(s < c[0]){
for(i = 0; i < m - 1; i++)
if((i == 0 ? s : c[i-1]) < t && c[i] >= t)
break;
}
else{
for(i = m - 1; i > 0; --i)
if((i + 1 == m ? s : c[i+1]) > t && c[i] <= t)
break;
}
return c[i];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1151 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3043 ms |
404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1204 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
883 ms |
460 KB |
Output is correct |
2 |
Runtime error |
966 ms |
2097156 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2013 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |