Submission #725423

# Submission time Handle Problem Language Result Execution time Memory
725423 2023-04-17T11:50:38 Z SanguineChameleon Game (APIO22_game) C++17
60 / 100
4000 ms 45872 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
 
const int shift = 9;
const int maxN = 3e5 + 20;
int L[maxN];
int R[maxN];
pair<int, int> range[maxN];
vector<int> adj1[maxN];
vector<int> adj2[maxN];
bool done = false;
int n, k;
 
void init(int _n, int _k) {
	n = _n;
	k = _k;
	for (int i = 0; i < k; i++) {
		L[i] = i;
		R[i] = i + 1;
	}
	for (int i = k; i < n; i++) {
		L[i] = 0;
		R[i] = k + 1;
	}
	for (int i = 0; i < n; i++) {
		range[i] = {0, k + 1};
	}
}
 
void update(int u);
 
void push(int u) {
	for (auto v: adj1[u]) {
		if (L[u] > L[v]) {
			L[v] = L[u];
			update(v);
		}
	}
	for (auto v: adj2[u]) {
		if (R[u] < R[v]) {
			R[v] = R[u];
			update(v);
		}
	}
}
 
void update(int u) {
	if (done) {
		return;
	}
	if (L[u] >= R[u]) {
		done = true;
		return;
	}
	push(u);
}
 
int add_teleporter(int u, int v) {
	int val = max(L[u], (u < k ? u + 1 : 0));
	if (val > L[v]) {
		L[v] = val;
		update(v);
	}
	if (R[v] < R[u]) {
		R[u] = R[v];
		update(u);
	}
	adj1[u].push_back(v);
	adj2[v].push_back(u);
	return done;
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 14288 KB Output is correct
2 Correct 11 ms 14364 KB Output is correct
3 Correct 12 ms 14376 KB Output is correct
4 Correct 11 ms 14288 KB Output is correct
5 Correct 13 ms 14420 KB Output is correct
6 Correct 10 ms 14372 KB Output is correct
7 Correct 16 ms 14324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 14288 KB Output is correct
2 Correct 11 ms 14364 KB Output is correct
3 Correct 12 ms 14376 KB Output is correct
4 Correct 11 ms 14288 KB Output is correct
5 Correct 13 ms 14420 KB Output is correct
6 Correct 10 ms 14372 KB Output is correct
7 Correct 16 ms 14324 KB Output is correct
8 Correct 10 ms 14288 KB Output is correct
9 Correct 11 ms 14288 KB Output is correct
10 Correct 11 ms 14288 KB Output is correct
11 Correct 11 ms 14396 KB Output is correct
12 Correct 10 ms 14416 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 12 ms 14460 KB Output is correct
15 Correct 10 ms 14416 KB Output is correct
16 Correct 11 ms 14420 KB Output is correct
17 Correct 8 ms 14416 KB Output is correct
18 Correct 8 ms 14416 KB Output is correct
19 Correct 9 ms 14388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 14288 KB Output is correct
2 Correct 11 ms 14364 KB Output is correct
3 Correct 12 ms 14376 KB Output is correct
4 Correct 11 ms 14288 KB Output is correct
5 Correct 13 ms 14420 KB Output is correct
6 Correct 10 ms 14372 KB Output is correct
7 Correct 16 ms 14324 KB Output is correct
8 Correct 10 ms 14288 KB Output is correct
9 Correct 11 ms 14288 KB Output is correct
10 Correct 11 ms 14288 KB Output is correct
11 Correct 11 ms 14396 KB Output is correct
12 Correct 10 ms 14416 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 12 ms 14460 KB Output is correct
15 Correct 10 ms 14416 KB Output is correct
16 Correct 11 ms 14420 KB Output is correct
17 Correct 8 ms 14416 KB Output is correct
18 Correct 8 ms 14416 KB Output is correct
19 Correct 9 ms 14388 KB Output is correct
20 Correct 9 ms 14436 KB Output is correct
21 Correct 9 ms 14344 KB Output is correct
22 Correct 10 ms 14416 KB Output is correct
23 Correct 9 ms 14416 KB Output is correct
24 Correct 14 ms 14416 KB Output is correct
25 Correct 11 ms 14416 KB Output is correct
26 Correct 10 ms 14416 KB Output is correct
27 Correct 9 ms 14484 KB Output is correct
28 Correct 10 ms 14368 KB Output is correct
29 Correct 10 ms 14416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 14288 KB Output is correct
2 Correct 11 ms 14364 KB Output is correct
3 Correct 12 ms 14376 KB Output is correct
4 Correct 11 ms 14288 KB Output is correct
5 Correct 13 ms 14420 KB Output is correct
6 Correct 10 ms 14372 KB Output is correct
7 Correct 16 ms 14324 KB Output is correct
8 Correct 10 ms 14288 KB Output is correct
9 Correct 11 ms 14288 KB Output is correct
10 Correct 11 ms 14288 KB Output is correct
11 Correct 11 ms 14396 KB Output is correct
12 Correct 10 ms 14416 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 12 ms 14460 KB Output is correct
15 Correct 10 ms 14416 KB Output is correct
16 Correct 11 ms 14420 KB Output is correct
17 Correct 8 ms 14416 KB Output is correct
18 Correct 8 ms 14416 KB Output is correct
19 Correct 9 ms 14388 KB Output is correct
20 Correct 9 ms 14436 KB Output is correct
21 Correct 9 ms 14344 KB Output is correct
22 Correct 10 ms 14416 KB Output is correct
23 Correct 9 ms 14416 KB Output is correct
24 Correct 14 ms 14416 KB Output is correct
25 Correct 11 ms 14416 KB Output is correct
26 Correct 10 ms 14416 KB Output is correct
27 Correct 9 ms 14484 KB Output is correct
28 Correct 10 ms 14368 KB Output is correct
29 Correct 10 ms 14416 KB Output is correct
30 Correct 24 ms 15896 KB Output is correct
31 Correct 14 ms 15224 KB Output is correct
32 Correct 31 ms 16952 KB Output is correct
33 Correct 29 ms 16712 KB Output is correct
34 Correct 1575 ms 18644 KB Output is correct
35 Correct 490 ms 17324 KB Output is correct
36 Correct 40 ms 16712 KB Output is correct
37 Correct 36 ms 16708 KB Output is correct
38 Correct 34 ms 16376 KB Output is correct
39 Correct 57 ms 16464 KB Output is correct
40 Correct 1189 ms 18508 KB Output is correct
41 Correct 208 ms 16976 KB Output is correct
42 Correct 145 ms 16772 KB Output is correct
43 Correct 48 ms 17716 KB Output is correct
44 Correct 1131 ms 18532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 14288 KB Output is correct
2 Correct 11 ms 14364 KB Output is correct
3 Correct 12 ms 14376 KB Output is correct
4 Correct 11 ms 14288 KB Output is correct
5 Correct 13 ms 14420 KB Output is correct
6 Correct 10 ms 14372 KB Output is correct
7 Correct 16 ms 14324 KB Output is correct
8 Correct 10 ms 14288 KB Output is correct
9 Correct 11 ms 14288 KB Output is correct
10 Correct 11 ms 14288 KB Output is correct
11 Correct 11 ms 14396 KB Output is correct
12 Correct 10 ms 14416 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 12 ms 14460 KB Output is correct
15 Correct 10 ms 14416 KB Output is correct
16 Correct 11 ms 14420 KB Output is correct
17 Correct 8 ms 14416 KB Output is correct
18 Correct 8 ms 14416 KB Output is correct
19 Correct 9 ms 14388 KB Output is correct
20 Correct 9 ms 14436 KB Output is correct
21 Correct 9 ms 14344 KB Output is correct
22 Correct 10 ms 14416 KB Output is correct
23 Correct 9 ms 14416 KB Output is correct
24 Correct 14 ms 14416 KB Output is correct
25 Correct 11 ms 14416 KB Output is correct
26 Correct 10 ms 14416 KB Output is correct
27 Correct 9 ms 14484 KB Output is correct
28 Correct 10 ms 14368 KB Output is correct
29 Correct 10 ms 14416 KB Output is correct
30 Correct 24 ms 15896 KB Output is correct
31 Correct 14 ms 15224 KB Output is correct
32 Correct 31 ms 16952 KB Output is correct
33 Correct 29 ms 16712 KB Output is correct
34 Correct 1575 ms 18644 KB Output is correct
35 Correct 490 ms 17324 KB Output is correct
36 Correct 40 ms 16712 KB Output is correct
37 Correct 36 ms 16708 KB Output is correct
38 Correct 34 ms 16376 KB Output is correct
39 Correct 57 ms 16464 KB Output is correct
40 Correct 1189 ms 18508 KB Output is correct
41 Correct 208 ms 16976 KB Output is correct
42 Correct 145 ms 16772 KB Output is correct
43 Correct 48 ms 17716 KB Output is correct
44 Correct 1131 ms 18532 KB Output is correct
45 Correct 263 ms 30416 KB Output is correct
46 Correct 17 ms 19424 KB Output is correct
47 Correct 18 ms 19440 KB Output is correct
48 Correct 329 ms 45872 KB Output is correct
49 Correct 270 ms 37860 KB Output is correct
50 Execution timed out 4049 ms 37856 KB Time limit exceeded
51 Halted 0 ms 0 KB -