#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
constexpr int N = 2005;
int timer;
vector<int> l, d;
vector<vector<int> > edges;
void dfs(int id){
d[id] = timer++;
for(int v : edges[id]){
if(d[v] == -1) dfs(v);
}
l[id] = timer++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){
edges.assign(n, vector<int>());
l.assign(n, -1);
d.assign(n, -1);
vector<int> ll(n);
for(int i = 0; i < n; i++){
edges[u[i]].push_back(v[i]);
edges[v[i]].push_back(u[i]);
}
timer = 0;
dfs(0);
for(int i = 0; i < n; i++){
ll[i] = N * d[i] + l[i];
}
return ll;
}
int find_next_station(int s, int t, std::vector<int> c){
int si = s / N, sl = s % N, ti = t / N, tl = t % N, dex = -1;
for(int x : c){
int ci = x / N, cl = x % N;
if(ci <= si && sl <= cl) dex = x;
}
for(int x : c){
int ci = x / N, cl = x % N;
if(x != dex && ci <= ti && tl <= cl) return x;
}
return dex;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
Runtime error |
3 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
947 ms |
640 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
651 ms |
1024 KB |
Partially correct |
2 |
Runtime error |
4 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |