Submission #746880

# Submission time Handle Problem Language Result Execution time Memory
746880 2023-05-23T08:01:54 Z tutis Game (APIO22_game) C++17
60 / 100
4000 ms 43596 KB
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
const int N = 300000;
int K;
struct data
{
	vector<int>adj[N];
	int mn[N];
	void f(int u, int v, int 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);
		adj[v].push_back(u);
	}

	int g(int v) {
		return mn[v];
	}
} q[2];
void init(int n, int k) {
	K = k;
	for (int i = 0; i < n; i++)
		q[0].mn[i] = -k;
	for (int i = 0; i < k; i++)
		q[0].mn[i] = -i - 1;
	for (int i = 0; i < k; i++)
		q[1].mn[i] = i;
	for (int i = k; i < n; i++)
		q[1].mn[i] = -1;
}

int add_teleporter(int u, int v) {
	int x = min(v, -q[0].g(v));
	int y = q[1].g(u);
	if (y >= x)
		return 1;
	x = -x;
	q[0].f(u, v, x);
	q[1].f(v, u, y);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14316 KB Output is correct
2 Correct 10 ms 14320 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14412 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14316 KB Output is correct
2 Correct 10 ms 14320 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14412 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 10 ms 14348 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 10 ms 14300 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 9 ms 14288 KB Output is correct
14 Correct 8 ms 14292 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14312 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 14316 KB Output is correct
2 Correct 10 ms 14320 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14412 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 10 ms 14348 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 10 ms 14300 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 9 ms 14288 KB Output is correct
14 Correct 8 ms 14292 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14312 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14288 KB Output is correct
20 Correct 10 ms 14416 KB Output is correct
21 Correct 8 ms 14288 KB Output is correct
22 Correct 9 ms 14416 KB Output is correct
23 Correct 9 ms 14416 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 12 ms 14428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14316 KB Output is correct
2 Correct 10 ms 14320 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14412 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 10 ms 14348 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 10 ms 14300 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 9 ms 14288 KB Output is correct
14 Correct 8 ms 14292 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14312 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14288 KB Output is correct
20 Correct 10 ms 14416 KB Output is correct
21 Correct 8 ms 14288 KB Output is correct
22 Correct 9 ms 14416 KB Output is correct
23 Correct 9 ms 14416 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 12 ms 14428 KB Output is correct
30 Correct 27 ms 15700 KB Output is correct
31 Correct 12 ms 15024 KB Output is correct
32 Correct 42 ms 16720 KB Output is correct
33 Correct 32 ms 16432 KB Output is correct
34 Correct 1234 ms 18348 KB Output is correct
35 Correct 395 ms 17092 KB Output is correct
36 Correct 47 ms 16404 KB Output is correct
37 Correct 36 ms 16448 KB Output is correct
38 Correct 47 ms 16248 KB Output is correct
39 Correct 56 ms 16276 KB Output is correct
40 Correct 979 ms 18280 KB Output is correct
41 Correct 199 ms 16812 KB Output is correct
42 Correct 126 ms 16652 KB Output is correct
43 Correct 63 ms 17464 KB Output is correct
44 Correct 955 ms 18332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14316 KB Output is correct
2 Correct 10 ms 14320 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14412 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 10 ms 14348 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 10 ms 14300 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 9 ms 14288 KB Output is correct
14 Correct 8 ms 14292 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14312 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14288 KB Output is correct
20 Correct 10 ms 14416 KB Output is correct
21 Correct 8 ms 14288 KB Output is correct
22 Correct 9 ms 14416 KB Output is correct
23 Correct 9 ms 14416 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 12 ms 14428 KB Output is correct
30 Correct 27 ms 15700 KB Output is correct
31 Correct 12 ms 15024 KB Output is correct
32 Correct 42 ms 16720 KB Output is correct
33 Correct 32 ms 16432 KB Output is correct
34 Correct 1234 ms 18348 KB Output is correct
35 Correct 395 ms 17092 KB Output is correct
36 Correct 47 ms 16404 KB Output is correct
37 Correct 36 ms 16448 KB Output is correct
38 Correct 47 ms 16248 KB Output is correct
39 Correct 56 ms 16276 KB Output is correct
40 Correct 979 ms 18280 KB Output is correct
41 Correct 199 ms 16812 KB Output is correct
42 Correct 126 ms 16652 KB Output is correct
43 Correct 63 ms 17464 KB Output is correct
44 Correct 955 ms 18332 KB Output is correct
45 Correct 260 ms 28080 KB Output is correct
46 Correct 14 ms 17128 KB Output is correct
47 Correct 14 ms 17104 KB Output is correct
48 Correct 344 ms 43596 KB Output is correct
49 Correct 351 ms 35440 KB Output is correct
50 Execution timed out 4032 ms 35508 KB Time limit exceeded
51 Halted 0 ms 0 KB -