#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
template<typename T>
int len(T &a){return a.size();}
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<vector<int>> g(n);
for(int i = 0; i < n - 1;i ++){
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
vector<int> tin(n), tout(n);
int tim = 0;
auto dfs = [&](auto &dfs, int i, int p = -1)->void{
tin[i] = tim ++;
for(auto u : g[i]){
if(u == p) continue;
dfs(dfs, u, i);
}
tout[i] = tim - 1;
};
dfs(dfs, 0);
vector<int> res(n);
for(int i = 0; i < n; i ++){
res[i] = tin[i] * 1000 + tout[i];
}
return res;
}
int find_next_station(int s, int t, vector<int> c) {
if(len(c) == 1) return c[0];
for(auto u : c){
if(t == u) return u;
}
int sin = s / 1000, sout = s % 1000;
int tin = t / 1000, tout = t % 1000;
if(tin < sin || tout > sout){
return c[0];
}
for(int i = (sin ? 1 : 0); i < len(c); i ++){
int u = c[i];
if(tout <= u % 1000){
return u;
}
}
assert(0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
344 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
349 ms |
684 KB |
Output is correct |
2 |
Correct |
305 ms |
684 KB |
Output is correct |
3 |
Correct |
616 ms |
684 KB |
Output is correct |
4 |
Correct |
434 ms |
688 KB |
Output is correct |
5 |
Correct |
445 ms |
684 KB |
Output is correct |
6 |
Correct |
359 ms |
684 KB |
Output is correct |
7 |
Correct |
332 ms |
688 KB |
Output is correct |
8 |
Correct |
1 ms |
776 KB |
Output is correct |
9 |
Correct |
2 ms |
772 KB |
Output is correct |
10 |
Correct |
1 ms |
776 KB |
Output is correct |
11 |
Correct |
425 ms |
684 KB |
Output is correct |
12 |
Correct |
361 ms |
764 KB |
Output is correct |
13 |
Correct |
277 ms |
684 KB |
Output is correct |
14 |
Correct |
310 ms |
684 KB |
Output is correct |
15 |
Correct |
30 ms |
764 KB |
Output is correct |
16 |
Correct |
33 ms |
768 KB |
Output is correct |
17 |
Correct |
75 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
629 ms |
684 KB |
Output is correct |
2 |
Correct |
420 ms |
684 KB |
Output is correct |
3 |
Correct |
465 ms |
684 KB |
Output is correct |
4 |
Correct |
2 ms |
764 KB |
Output is correct |
5 |
Correct |
1 ms |
768 KB |
Output is correct |
6 |
Correct |
0 ms |
768 KB |
Output is correct |
7 |
Correct |
380 ms |
684 KB |
Output is correct |
8 |
Correct |
560 ms |
684 KB |
Output is correct |
9 |
Correct |
412 ms |
684 KB |
Output is correct |
10 |
Correct |
391 ms |
684 KB |
Output is correct |
11 |
Correct |
2 ms |
772 KB |
Output is correct |
12 |
Correct |
2 ms |
768 KB |
Output is correct |
13 |
Correct |
2 ms |
776 KB |
Output is correct |
14 |
Correct |
1 ms |
768 KB |
Output is correct |
15 |
Correct |
0 ms |
768 KB |
Output is correct |
16 |
Correct |
287 ms |
684 KB |
Output is correct |
17 |
Correct |
378 ms |
684 KB |
Output is correct |
18 |
Correct |
331 ms |
684 KB |
Output is correct |
19 |
Correct |
351 ms |
684 KB |
Output is correct |
20 |
Correct |
274 ms |
684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
298 ms |
684 KB |
Partially correct |
2 |
Partially correct |
248 ms |
1136 KB |
Partially correct |
3 |
Partially correct |
566 ms |
684 KB |
Partially correct |
4 |
Partially correct |
434 ms |
684 KB |
Partially correct |
5 |
Partially correct |
405 ms |
684 KB |
Partially correct |
6 |
Partially correct |
268 ms |
684 KB |
Partially correct |
7 |
Partially correct |
282 ms |
684 KB |
Partially correct |
8 |
Partially correct |
1 ms |
768 KB |
Partially correct |
9 |
Partially correct |
2 ms |
764 KB |
Partially correct |
10 |
Partially correct |
1 ms |
768 KB |
Partially correct |
11 |
Partially correct |
289 ms |
780 KB |
Partially correct |
12 |
Partially correct |
314 ms |
684 KB |
Partially correct |
13 |
Partially correct |
575 ms |
684 KB |
Partially correct |
14 |
Partially correct |
398 ms |
940 KB |
Partially correct |
15 |
Partially correct |
354 ms |
684 KB |
Partially correct |
16 |
Partially correct |
278 ms |
684 KB |
Partially correct |
17 |
Partially correct |
336 ms |
684 KB |
Partially correct |
18 |
Partially correct |
258 ms |
932 KB |
Partially correct |
19 |
Partially correct |
285 ms |
684 KB |
Partially correct |
20 |
Partially correct |
291 ms |
684 KB |
Partially correct |
21 |
Partially correct |
24 ms |
768 KB |
Partially correct |
22 |
Partially correct |
45 ms |
796 KB |
Partially correct |
23 |
Partially correct |
64 ms |
716 KB |
Partially correct |
24 |
Partially correct |
2 ms |
768 KB |
Partially correct |
25 |
Partially correct |
2 ms |
768 KB |
Partially correct |
26 |
Partially correct |
1 ms |
768 KB |
Partially correct |
27 |
Partially correct |
1 ms |
768 KB |
Partially correct |
28 |
Partially correct |
0 ms |
776 KB |
Partially correct |
29 |
Partially correct |
311 ms |
776 KB |
Partially correct |
30 |
Partially correct |
288 ms |
684 KB |
Partially correct |
31 |
Partially correct |
302 ms |
936 KB |
Partially correct |
32 |
Partially correct |
304 ms |
688 KB |
Partially correct |
33 |
Partially correct |
318 ms |
684 KB |
Partially correct |
34 |
Partially correct |
181 ms |
684 KB |
Partially correct |
35 |
Partially correct |
256 ms |
688 KB |
Partially correct |
36 |
Partially correct |
310 ms |
932 KB |
Partially correct |
37 |
Partially correct |
289 ms |
1196 KB |
Partially correct |
38 |
Partially correct |
291 ms |
1192 KB |
Partially correct |
39 |
Partially correct |
269 ms |
788 KB |
Partially correct |
40 |
Partially correct |
270 ms |
768 KB |
Partially correct |
41 |
Partially correct |
272 ms |
772 KB |
Partially correct |
42 |
Partially correct |
31 ms |
768 KB |
Partially correct |
43 |
Partially correct |
53 ms |
684 KB |
Partially correct |
44 |
Partially correct |
77 ms |
684 KB |
Partially correct |
45 |
Partially correct |
98 ms |
684 KB |
Partially correct |
46 |
Partially correct |
175 ms |
716 KB |
Partially correct |
47 |
Partially correct |
202 ms |
684 KB |
Partially correct |
48 |
Partially correct |
30 ms |
972 KB |
Partially correct |
49 |
Partially correct |
24 ms |
768 KB |
Partially correct |