# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
746869 |
2023-05-23T07:44:10 Z |
tutis |
게임 (APIO22_game) |
C++17 |
|
4000 ms |
43448 KB |
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
const int N = 300000;
int K;
vector<int>adj_[N];
vector<int>adj[N];
int mn[N];
int mx[N];
void init(int n, int k) {
K = k;
for (int i = 0; i < n; i++)
mn[i] = k;
for (int i = 0; i < k; i++)
mn[i] = i + 1;
for (int i = 0; i < k; i++)
mx[i] = i;
for (int i = k; i < n; i++)
mx[i] = -1;
}
int add_teleporter(int u, int v) {
int x = min(v, mn[v]);
int y = mx[u];
if (y >= x)
return 1;
function<void(int)>dfs = [&](int i) {
mn[i] = x;
for (int j : adj_[i])
if (mn[j] > x)
dfs(j);
};
if (mn[u] > x)
dfs(u);
function<void(int)>dfs1 = [&](int i) {
mx[i] = y;
for (int j : adj[i])
if (y > mx[j])
dfs1(j);
};
if (y > mx[v])
dfs1(v);
adj[u].push_back(v);
adj_[v].push_back(u);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14288 KB |
Output is correct |
2 |
Correct |
10 ms |
14372 KB |
Output is correct |
3 |
Correct |
9 ms |
14288 KB |
Output is correct |
4 |
Correct |
9 ms |
14312 KB |
Output is correct |
5 |
Correct |
9 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14360 KB |
Output is correct |
7 |
Correct |
9 ms |
14388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14288 KB |
Output is correct |
2 |
Correct |
10 ms |
14372 KB |
Output is correct |
3 |
Correct |
9 ms |
14288 KB |
Output is correct |
4 |
Correct |
9 ms |
14312 KB |
Output is correct |
5 |
Correct |
9 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14360 KB |
Output is correct |
7 |
Correct |
9 ms |
14388 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14340 KB |
Output is correct |
10 |
Correct |
9 ms |
14356 KB |
Output is correct |
11 |
Correct |
9 ms |
14348 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
11 ms |
14384 KB |
Output is correct |
14 |
Correct |
9 ms |
14384 KB |
Output is correct |
15 |
Correct |
9 ms |
14288 KB |
Output is correct |
16 |
Correct |
10 ms |
14288 KB |
Output is correct |
17 |
Correct |
9 ms |
14288 KB |
Output is correct |
18 |
Correct |
9 ms |
14300 KB |
Output is correct |
19 |
Correct |
10 ms |
14288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14288 KB |
Output is correct |
2 |
Correct |
10 ms |
14372 KB |
Output is correct |
3 |
Correct |
9 ms |
14288 KB |
Output is correct |
4 |
Correct |
9 ms |
14312 KB |
Output is correct |
5 |
Correct |
9 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14360 KB |
Output is correct |
7 |
Correct |
9 ms |
14388 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14340 KB |
Output is correct |
10 |
Correct |
9 ms |
14356 KB |
Output is correct |
11 |
Correct |
9 ms |
14348 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
11 ms |
14384 KB |
Output is correct |
14 |
Correct |
9 ms |
14384 KB |
Output is correct |
15 |
Correct |
9 ms |
14288 KB |
Output is correct |
16 |
Correct |
10 ms |
14288 KB |
Output is correct |
17 |
Correct |
9 ms |
14288 KB |
Output is correct |
18 |
Correct |
9 ms |
14300 KB |
Output is correct |
19 |
Correct |
10 ms |
14288 KB |
Output is correct |
20 |
Correct |
10 ms |
14416 KB |
Output is correct |
21 |
Correct |
11 ms |
14360 KB |
Output is correct |
22 |
Correct |
10 ms |
14416 KB |
Output is correct |
23 |
Correct |
11 ms |
14444 KB |
Output is correct |
24 |
Correct |
14 ms |
14484 KB |
Output is correct |
25 |
Correct |
12 ms |
14512 KB |
Output is correct |
26 |
Correct |
11 ms |
14480 KB |
Output is correct |
27 |
Correct |
11 ms |
14436 KB |
Output is correct |
28 |
Correct |
10 ms |
14416 KB |
Output is correct |
29 |
Correct |
11 ms |
14416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14288 KB |
Output is correct |
2 |
Correct |
10 ms |
14372 KB |
Output is correct |
3 |
Correct |
9 ms |
14288 KB |
Output is correct |
4 |
Correct |
9 ms |
14312 KB |
Output is correct |
5 |
Correct |
9 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14360 KB |
Output is correct |
7 |
Correct |
9 ms |
14388 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14340 KB |
Output is correct |
10 |
Correct |
9 ms |
14356 KB |
Output is correct |
11 |
Correct |
9 ms |
14348 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
11 ms |
14384 KB |
Output is correct |
14 |
Correct |
9 ms |
14384 KB |
Output is correct |
15 |
Correct |
9 ms |
14288 KB |
Output is correct |
16 |
Correct |
10 ms |
14288 KB |
Output is correct |
17 |
Correct |
9 ms |
14288 KB |
Output is correct |
18 |
Correct |
9 ms |
14300 KB |
Output is correct |
19 |
Correct |
10 ms |
14288 KB |
Output is correct |
20 |
Correct |
10 ms |
14416 KB |
Output is correct |
21 |
Correct |
11 ms |
14360 KB |
Output is correct |
22 |
Correct |
10 ms |
14416 KB |
Output is correct |
23 |
Correct |
11 ms |
14444 KB |
Output is correct |
24 |
Correct |
14 ms |
14484 KB |
Output is correct |
25 |
Correct |
12 ms |
14512 KB |
Output is correct |
26 |
Correct |
11 ms |
14480 KB |
Output is correct |
27 |
Correct |
11 ms |
14436 KB |
Output is correct |
28 |
Correct |
10 ms |
14416 KB |
Output is correct |
29 |
Correct |
11 ms |
14416 KB |
Output is correct |
30 |
Correct |
23 ms |
15740 KB |
Output is correct |
31 |
Correct |
13 ms |
14928 KB |
Output is correct |
32 |
Correct |
29 ms |
16724 KB |
Output is correct |
33 |
Correct |
28 ms |
16552 KB |
Output is correct |
34 |
Correct |
1316 ms |
18380 KB |
Output is correct |
35 |
Correct |
453 ms |
17144 KB |
Output is correct |
36 |
Correct |
43 ms |
16488 KB |
Output is correct |
37 |
Correct |
46 ms |
16376 KB |
Output is correct |
38 |
Correct |
44 ms |
16268 KB |
Output is correct |
39 |
Correct |
38 ms |
16176 KB |
Output is correct |
40 |
Correct |
1069 ms |
18424 KB |
Output is correct |
41 |
Correct |
222 ms |
16712 KB |
Output is correct |
42 |
Correct |
130 ms |
16528 KB |
Output is correct |
43 |
Correct |
60 ms |
17464 KB |
Output is correct |
44 |
Correct |
874 ms |
18412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14288 KB |
Output is correct |
2 |
Correct |
10 ms |
14372 KB |
Output is correct |
3 |
Correct |
9 ms |
14288 KB |
Output is correct |
4 |
Correct |
9 ms |
14312 KB |
Output is correct |
5 |
Correct |
9 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14360 KB |
Output is correct |
7 |
Correct |
9 ms |
14388 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14340 KB |
Output is correct |
10 |
Correct |
9 ms |
14356 KB |
Output is correct |
11 |
Correct |
9 ms |
14348 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
11 ms |
14384 KB |
Output is correct |
14 |
Correct |
9 ms |
14384 KB |
Output is correct |
15 |
Correct |
9 ms |
14288 KB |
Output is correct |
16 |
Correct |
10 ms |
14288 KB |
Output is correct |
17 |
Correct |
9 ms |
14288 KB |
Output is correct |
18 |
Correct |
9 ms |
14300 KB |
Output is correct |
19 |
Correct |
10 ms |
14288 KB |
Output is correct |
20 |
Correct |
10 ms |
14416 KB |
Output is correct |
21 |
Correct |
11 ms |
14360 KB |
Output is correct |
22 |
Correct |
10 ms |
14416 KB |
Output is correct |
23 |
Correct |
11 ms |
14444 KB |
Output is correct |
24 |
Correct |
14 ms |
14484 KB |
Output is correct |
25 |
Correct |
12 ms |
14512 KB |
Output is correct |
26 |
Correct |
11 ms |
14480 KB |
Output is correct |
27 |
Correct |
11 ms |
14436 KB |
Output is correct |
28 |
Correct |
10 ms |
14416 KB |
Output is correct |
29 |
Correct |
11 ms |
14416 KB |
Output is correct |
30 |
Correct |
23 ms |
15740 KB |
Output is correct |
31 |
Correct |
13 ms |
14928 KB |
Output is correct |
32 |
Correct |
29 ms |
16724 KB |
Output is correct |
33 |
Correct |
28 ms |
16552 KB |
Output is correct |
34 |
Correct |
1316 ms |
18380 KB |
Output is correct |
35 |
Correct |
453 ms |
17144 KB |
Output is correct |
36 |
Correct |
43 ms |
16488 KB |
Output is correct |
37 |
Correct |
46 ms |
16376 KB |
Output is correct |
38 |
Correct |
44 ms |
16268 KB |
Output is correct |
39 |
Correct |
38 ms |
16176 KB |
Output is correct |
40 |
Correct |
1069 ms |
18424 KB |
Output is correct |
41 |
Correct |
222 ms |
16712 KB |
Output is correct |
42 |
Correct |
130 ms |
16528 KB |
Output is correct |
43 |
Correct |
60 ms |
17464 KB |
Output is correct |
44 |
Correct |
874 ms |
18412 KB |
Output is correct |
45 |
Correct |
252 ms |
27980 KB |
Output is correct |
46 |
Correct |
15 ms |
17104 KB |
Output is correct |
47 |
Correct |
18 ms |
16988 KB |
Output is correct |
48 |
Correct |
336 ms |
43448 KB |
Output is correct |
49 |
Correct |
294 ms |
35488 KB |
Output is correct |
50 |
Execution timed out |
4009 ms |
35508 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |