Submission #816990

# Submission time Handle Problem Language Result Execution time Memory
816990 2023-08-09T08:14:08 Z 박영우(#10128) Game (APIO22_game) C++17
60 / 100
1197 ms 5984 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define MAX 50505
vector<int> adj[MAX], radj[MAX];
int N, K;
int mn[MAX];
int mx[MAX];

void init(int n, int k) {
	N = n;
	K = k;
	int i;
	for (i = 0; i < K; i++) mn[i] = i, mx[i] = i;
	for (i = K; i < N; i++) mn[i] = K, mx[i] = -1;
}

void updf(int x) {
	for (auto v : adj[x]) {
		if (mx[v] < mx[x]) {
			mx[v] = mx[x];
			updf(v);
		}
	}
}
void updr(int x) {
	for (auto v : radj[x]) {
		if (mn[v] > mn[x]) {
			mn[v] = mn[x];
			updr(v);
		}
	}
}

int add_teleporter(int u, int v) {
	if (u < K && v < K) {
		if (u >= v) return 1;
		else return 0;
	}
	adj[u].push_back(v);
	radj[v].push_back(u);
	updf(u);
	updr(v);
	int i;
	for (i = K; i < N; i++) if (mn[i] <= mx[i]) return 1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2640 KB Output is correct
2 Correct 2 ms 2640 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 1 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 2 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2640 KB Output is correct
2 Correct 2 ms 2640 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 1 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 2 ms 2640 KB Output is correct
8 Correct 1 ms 2640 KB Output is correct
9 Correct 1 ms 2640 KB Output is correct
10 Correct 1 ms 2640 KB Output is correct
11 Correct 1 ms 2640 KB Output is correct
12 Correct 1 ms 2640 KB Output is correct
13 Correct 1 ms 2640 KB Output is correct
14 Correct 1 ms 2640 KB Output is correct
15 Correct 1 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 2 ms 2640 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2640 KB Output is correct
2 Correct 2 ms 2640 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 1 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 2 ms 2640 KB Output is correct
8 Correct 1 ms 2640 KB Output is correct
9 Correct 1 ms 2640 KB Output is correct
10 Correct 1 ms 2640 KB Output is correct
11 Correct 1 ms 2640 KB Output is correct
12 Correct 1 ms 2640 KB Output is correct
13 Correct 1 ms 2640 KB Output is correct
14 Correct 1 ms 2640 KB Output is correct
15 Correct 1 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 2 ms 2640 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2684 KB Output is correct
20 Correct 2 ms 2640 KB Output is correct
21 Correct 2 ms 2692 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 2 ms 2696 KB Output is correct
24 Correct 4 ms 2748 KB Output is correct
25 Correct 5 ms 2732 KB Output is correct
26 Correct 7 ms 2772 KB Output is correct
27 Correct 5 ms 2768 KB Output is correct
28 Correct 3 ms 2640 KB Output is correct
29 Correct 5 ms 2712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2640 KB Output is correct
2 Correct 2 ms 2640 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 1 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 2 ms 2640 KB Output is correct
8 Correct 1 ms 2640 KB Output is correct
9 Correct 1 ms 2640 KB Output is correct
10 Correct 1 ms 2640 KB Output is correct
11 Correct 1 ms 2640 KB Output is correct
12 Correct 1 ms 2640 KB Output is correct
13 Correct 1 ms 2640 KB Output is correct
14 Correct 1 ms 2640 KB Output is correct
15 Correct 1 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 2 ms 2640 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2684 KB Output is correct
20 Correct 2 ms 2640 KB Output is correct
21 Correct 2 ms 2692 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 2 ms 2696 KB Output is correct
24 Correct 4 ms 2748 KB Output is correct
25 Correct 5 ms 2732 KB Output is correct
26 Correct 7 ms 2772 KB Output is correct
27 Correct 5 ms 2768 KB Output is correct
28 Correct 3 ms 2640 KB Output is correct
29 Correct 5 ms 2712 KB Output is correct
30 Correct 373 ms 3980 KB Output is correct
31 Correct 86 ms 3236 KB Output is correct
32 Correct 374 ms 5112 KB Output is correct
33 Correct 360 ms 4668 KB Output is correct
34 Correct 1182 ms 5488 KB Output is correct
35 Correct 771 ms 5084 KB Output is correct
36 Correct 544 ms 4772 KB Output is correct
37 Correct 465 ms 4668 KB Output is correct
38 Correct 546 ms 4548 KB Output is correct
39 Correct 489 ms 4508 KB Output is correct
40 Correct 1197 ms 5728 KB Output is correct
41 Correct 636 ms 4744 KB Output is correct
42 Correct 546 ms 4716 KB Output is correct
43 Correct 508 ms 5556 KB Output is correct
44 Correct 1120 ms 5496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2640 KB Output is correct
2 Correct 2 ms 2640 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 1 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 2 ms 2640 KB Output is correct
8 Correct 1 ms 2640 KB Output is correct
9 Correct 1 ms 2640 KB Output is correct
10 Correct 1 ms 2640 KB Output is correct
11 Correct 1 ms 2640 KB Output is correct
12 Correct 1 ms 2640 KB Output is correct
13 Correct 1 ms 2640 KB Output is correct
14 Correct 1 ms 2640 KB Output is correct
15 Correct 1 ms 2640 KB Output is correct
16 Correct 2 ms 2640 KB Output is correct
17 Correct 2 ms 2640 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2684 KB Output is correct
20 Correct 2 ms 2640 KB Output is correct
21 Correct 2 ms 2692 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 2 ms 2696 KB Output is correct
24 Correct 4 ms 2748 KB Output is correct
25 Correct 5 ms 2732 KB Output is correct
26 Correct 7 ms 2772 KB Output is correct
27 Correct 5 ms 2768 KB Output is correct
28 Correct 3 ms 2640 KB Output is correct
29 Correct 5 ms 2712 KB Output is correct
30 Correct 373 ms 3980 KB Output is correct
31 Correct 86 ms 3236 KB Output is correct
32 Correct 374 ms 5112 KB Output is correct
33 Correct 360 ms 4668 KB Output is correct
34 Correct 1182 ms 5488 KB Output is correct
35 Correct 771 ms 5084 KB Output is correct
36 Correct 544 ms 4772 KB Output is correct
37 Correct 465 ms 4668 KB Output is correct
38 Correct 546 ms 4548 KB Output is correct
39 Correct 489 ms 4508 KB Output is correct
40 Correct 1197 ms 5728 KB Output is correct
41 Correct 636 ms 4744 KB Output is correct
42 Correct 546 ms 4716 KB Output is correct
43 Correct 508 ms 5556 KB Output is correct
44 Correct 1120 ms 5496 KB Output is correct
45 Runtime error 5 ms 5984 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -