#include "stations.h"
#ifndef EVAL
#include "stub.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define all(x) x.begin(), x.end()
const int NN = 1e3+5;
vector<int> edges[NN], val;
int tim;
void dfs(int u, int t, int p){
if(t) val[u] = ++tim;
for(auto x:edges[u]) if(x != p) dfs(x, t^1, u);
if(!t) val[u] = ++tim;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
for(int i=0;i<n-1;i++){
edges[u[i]].pb(v[i]);
edges[v[i]].pb(u[i]);
}
val.resize(n);
tim = -1;
dfs(0, 1, -1);
return val;
}
int find_next_station(int s, int t, vector<int> c){
sort(all(c));
if(s < c[0]){
int p = c[sz(c)-1];
if(t >= p || t < s) return p;
int i = 0;
while(c[i] < t && i < sz(c)-1) i++;
return c[i];
}
else{
int p = c[0];
if(t > s || t < c[1]) return p;
int i = sz(c)-1;
while(c[i] > t && i > 0) i--;
return c[i];
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1320 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3040 ms |
532 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1424 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
946 ms |
864 KB |
Output is correct |
2 |
Runtime error |
1184 ms |
2097152 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2246 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |