답안 #746877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
746877 2023-05-23T07:59:22 Z tutis 게임 (APIO22_game) C++17
60 / 100
4000 ms 43620 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[2][N];
int mn[2][N];
void init(int n, int k) {
	K = k;
	for (int i = 0; i < n; i++)
		mn[0][i] = -k;
	for (int i = 0; i < k; i++)
		mn[0][i] = -i - 1;
	for (int i = 0; i < k; i++)
		mn[1][i] = i;
	for (int i = k; i < n; i++)
		mn[1][i] = -1;
}
void f(int t, int u, int v, int x) {
	function<void(int)>dfs = [&](int i) {
		mn[t][i] = x;
		for (int j : adj[t][i])
			if (mn[t][j] < x)
				dfs(j);
	};
	if (mn[t][u] < x)
		dfs(u);
	adj[t][v].push_back(u);
}

int g(int t, int v) {
	return mn[t][v];
}

int add_teleporter(int u, int v) {
	int x = min(v, -g(0, v));
	int y = g(1, u);
	if (y >= x)
		return 1;
	x = -x;
	f(0, u, v, x);
	f(1, v, u, y);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 9 ms 14340 KB Output is correct
3 Correct 9 ms 14400 KB Output is correct
4 Correct 12 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 13 ms 14404 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 9 ms 14340 KB Output is correct
3 Correct 9 ms 14400 KB Output is correct
4 Correct 12 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 13 ms 14404 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 12 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14340 KB Output is correct
14 Correct 10 ms 14292 KB Output is correct
15 Correct 10 ms 14288 KB Output is correct
16 Correct 9 ms 14352 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 13 ms 14336 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 9 ms 14340 KB Output is correct
3 Correct 9 ms 14400 KB Output is correct
4 Correct 12 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 13 ms 14404 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 12 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14340 KB Output is correct
14 Correct 10 ms 14292 KB Output is correct
15 Correct 10 ms 14288 KB Output is correct
16 Correct 9 ms 14352 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 13 ms 14336 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
20 Correct 10 ms 14416 KB Output is correct
21 Correct 9 ms 14288 KB Output is correct
22 Correct 10 ms 14420 KB Output is correct
23 Correct 12 ms 14396 KB Output is correct
24 Correct 14 ms 14416 KB Output is correct
25 Correct 12 ms 14416 KB Output is correct
26 Correct 12 ms 14416 KB Output is correct
27 Correct 12 ms 14428 KB Output is correct
28 Correct 11 ms 14416 KB Output is correct
29 Correct 13 ms 14460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 9 ms 14340 KB Output is correct
3 Correct 9 ms 14400 KB Output is correct
4 Correct 12 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 13 ms 14404 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 12 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14340 KB Output is correct
14 Correct 10 ms 14292 KB Output is correct
15 Correct 10 ms 14288 KB Output is correct
16 Correct 9 ms 14352 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 13 ms 14336 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
20 Correct 10 ms 14416 KB Output is correct
21 Correct 9 ms 14288 KB Output is correct
22 Correct 10 ms 14420 KB Output is correct
23 Correct 12 ms 14396 KB Output is correct
24 Correct 14 ms 14416 KB Output is correct
25 Correct 12 ms 14416 KB Output is correct
26 Correct 12 ms 14416 KB Output is correct
27 Correct 12 ms 14428 KB Output is correct
28 Correct 11 ms 14416 KB Output is correct
29 Correct 13 ms 14460 KB Output is correct
30 Correct 31 ms 15764 KB Output is correct
31 Correct 17 ms 14920 KB Output is correct
32 Correct 43 ms 16744 KB Output is correct
33 Correct 40 ms 16436 KB Output is correct
34 Correct 1778 ms 18276 KB Output is correct
35 Correct 468 ms 17148 KB Output is correct
36 Correct 68 ms 16412 KB Output is correct
37 Correct 42 ms 16456 KB Output is correct
38 Correct 42 ms 16188 KB Output is correct
39 Correct 53 ms 16220 KB Output is correct
40 Correct 1454 ms 18412 KB Output is correct
41 Correct 224 ms 16740 KB Output is correct
42 Correct 136 ms 16680 KB Output is correct
43 Correct 84 ms 17512 KB Output is correct
44 Correct 1062 ms 18412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 9 ms 14340 KB Output is correct
3 Correct 9 ms 14400 KB Output is correct
4 Correct 12 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 13 ms 14404 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 12 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14340 KB Output is correct
14 Correct 10 ms 14292 KB Output is correct
15 Correct 10 ms 14288 KB Output is correct
16 Correct 9 ms 14352 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 13 ms 14336 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
20 Correct 10 ms 14416 KB Output is correct
21 Correct 9 ms 14288 KB Output is correct
22 Correct 10 ms 14420 KB Output is correct
23 Correct 12 ms 14396 KB Output is correct
24 Correct 14 ms 14416 KB Output is correct
25 Correct 12 ms 14416 KB Output is correct
26 Correct 12 ms 14416 KB Output is correct
27 Correct 12 ms 14428 KB Output is correct
28 Correct 11 ms 14416 KB Output is correct
29 Correct 13 ms 14460 KB Output is correct
30 Correct 31 ms 15764 KB Output is correct
31 Correct 17 ms 14920 KB Output is correct
32 Correct 43 ms 16744 KB Output is correct
33 Correct 40 ms 16436 KB Output is correct
34 Correct 1778 ms 18276 KB Output is correct
35 Correct 468 ms 17148 KB Output is correct
36 Correct 68 ms 16412 KB Output is correct
37 Correct 42 ms 16456 KB Output is correct
38 Correct 42 ms 16188 KB Output is correct
39 Correct 53 ms 16220 KB Output is correct
40 Correct 1454 ms 18412 KB Output is correct
41 Correct 224 ms 16740 KB Output is correct
42 Correct 136 ms 16680 KB Output is correct
43 Correct 84 ms 17512 KB Output is correct
44 Correct 1062 ms 18412 KB Output is correct
45 Correct 275 ms 27992 KB Output is correct
46 Correct 15 ms 17104 KB Output is correct
47 Correct 18 ms 17000 KB Output is correct
48 Correct 378 ms 43620 KB Output is correct
49 Correct 305 ms 35512 KB Output is correct
50 Execution timed out 4010 ms 35504 KB Time limit exceeded
51 Halted 0 ms 0 KB -