Submission #746873

# Submission time Handle Problem Language Result Execution time Memory
746873 2023-05-23T07:52:54 Z tutis Game (APIO22_game) C++17
60 / 100
4000 ms 43504 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;
	x = -x;
	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;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 9 ms 14408 KB Output is correct
6 Correct 10 ms 14288 KB Output is correct
7 Correct 9 ms 14320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 9 ms 14408 KB Output is correct
6 Correct 10 ms 14288 KB Output is correct
7 Correct 9 ms 14320 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14380 KB Output is correct
10 Correct 8 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 9 ms 14416 KB Output is correct
13 Correct 10 ms 14416 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 9 ms 14288 KB Output is correct
16 Correct 9 ms 14288 KB Output is correct
17 Correct 12 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 9 ms 14408 KB Output is correct
6 Correct 10 ms 14288 KB Output is correct
7 Correct 9 ms 14320 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14380 KB Output is correct
10 Correct 8 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 9 ms 14416 KB Output is correct
13 Correct 10 ms 14416 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 9 ms 14288 KB Output is correct
16 Correct 9 ms 14288 KB Output is correct
17 Correct 12 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14288 KB Output is correct
20 Correct 12 ms 14416 KB Output is correct
21 Correct 9 ms 14288 KB Output is correct
22 Correct 11 ms 14460 KB Output is correct
23 Correct 12 ms 14396 KB Output is correct
24 Correct 13 ms 14416 KB Output is correct
25 Correct 11 ms 14416 KB Output is correct
26 Correct 11 ms 14416 KB Output is correct
27 Correct 11 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 10 ms 14416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 9 ms 14408 KB Output is correct
6 Correct 10 ms 14288 KB Output is correct
7 Correct 9 ms 14320 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14380 KB Output is correct
10 Correct 8 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 9 ms 14416 KB Output is correct
13 Correct 10 ms 14416 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 9 ms 14288 KB Output is correct
16 Correct 9 ms 14288 KB Output is correct
17 Correct 12 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14288 KB Output is correct
20 Correct 12 ms 14416 KB Output is correct
21 Correct 9 ms 14288 KB Output is correct
22 Correct 11 ms 14460 KB Output is correct
23 Correct 12 ms 14396 KB Output is correct
24 Correct 13 ms 14416 KB Output is correct
25 Correct 11 ms 14416 KB Output is correct
26 Correct 11 ms 14416 KB Output is correct
27 Correct 11 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 10 ms 14416 KB Output is correct
30 Correct 28 ms 15744 KB Output is correct
31 Correct 13 ms 14944 KB Output is correct
32 Correct 36 ms 16712 KB Output is correct
33 Correct 33 ms 16404 KB Output is correct
34 Correct 1436 ms 18276 KB Output is correct
35 Correct 410 ms 17148 KB Output is correct
36 Correct 44 ms 16484 KB Output is correct
37 Correct 36 ms 16420 KB Output is correct
38 Correct 34 ms 16200 KB Output is correct
39 Correct 44 ms 16220 KB Output is correct
40 Correct 1088 ms 18424 KB Output is correct
41 Correct 177 ms 16932 KB Output is correct
42 Correct 130 ms 16536 KB Output is correct
43 Correct 54 ms 17436 KB Output is correct
44 Correct 853 ms 18292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 9 ms 14408 KB Output is correct
6 Correct 10 ms 14288 KB Output is correct
7 Correct 9 ms 14320 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14380 KB Output is correct
10 Correct 8 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 9 ms 14416 KB Output is correct
13 Correct 10 ms 14416 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 9 ms 14288 KB Output is correct
16 Correct 9 ms 14288 KB Output is correct
17 Correct 12 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14288 KB Output is correct
20 Correct 12 ms 14416 KB Output is correct
21 Correct 9 ms 14288 KB Output is correct
22 Correct 11 ms 14460 KB Output is correct
23 Correct 12 ms 14396 KB Output is correct
24 Correct 13 ms 14416 KB Output is correct
25 Correct 11 ms 14416 KB Output is correct
26 Correct 11 ms 14416 KB Output is correct
27 Correct 11 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 10 ms 14416 KB Output is correct
30 Correct 28 ms 15744 KB Output is correct
31 Correct 13 ms 14944 KB Output is correct
32 Correct 36 ms 16712 KB Output is correct
33 Correct 33 ms 16404 KB Output is correct
34 Correct 1436 ms 18276 KB Output is correct
35 Correct 410 ms 17148 KB Output is correct
36 Correct 44 ms 16484 KB Output is correct
37 Correct 36 ms 16420 KB Output is correct
38 Correct 34 ms 16200 KB Output is correct
39 Correct 44 ms 16220 KB Output is correct
40 Correct 1088 ms 18424 KB Output is correct
41 Correct 177 ms 16932 KB Output is correct
42 Correct 130 ms 16536 KB Output is correct
43 Correct 54 ms 17436 KB Output is correct
44 Correct 853 ms 18292 KB Output is correct
45 Correct 250 ms 28072 KB Output is correct
46 Correct 16 ms 17104 KB Output is correct
47 Correct 14 ms 17012 KB Output is correct
48 Correct 332 ms 43504 KB Output is correct
49 Correct 238 ms 35392 KB Output is correct
50 Execution timed out 4066 ms 35500 KB Time limit exceeded
51 Halted 0 ms 0 KB -