Submission #966837

# Submission time Handle Problem Language Result Execution time Memory
966837 2024-04-20T13:01:39 Z josanneo22 Game (APIO22_game) C++17
60 / 100
1574 ms 120904 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

const int nax = 30005;
const int kax = 1005;
int reach[kax][nax], N, K;
vector<int> G[nax];
bool ok;

void dfs(int tp, int u) {
	reach[tp][u] = 1;
	if (u <= tp) ok = true;
	for (auto & v : G[u]) {
		if (!reach[tp][v]) {
			dfs(tp, v);
		}
	}
}
void init(int n, int k) {
	N = n; K = k; ok = false;
	for (int i = 1; i <= k - 1; i++) G[i].push_back(i + 1);
	for (int i = 1; i <= k - 1; i++) dfs(i, i + 1);
}
int add_teleporter(int u, int v) {
	u++; v++;
	G[u].push_back(v);
	for (int i = 1; i <= K; i++) {
		if ((u == i || reach[i][u]) && !reach[i][v]) {
			dfs(i, v);
		}
	}
	return ok;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 2 ms 12912 KB Output is correct
4 Correct 1 ms 6744 KB Output is correct
5 Correct 2 ms 12888 KB Output is correct
6 Correct 2 ms 12884 KB Output is correct
7 Correct 2 ms 12888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 2 ms 12912 KB Output is correct
4 Correct 1 ms 6744 KB Output is correct
5 Correct 2 ms 12888 KB Output is correct
6 Correct 2 ms 12884 KB Output is correct
7 Correct 2 ms 12888 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 2 ms 8792 KB Output is correct
15 Correct 1 ms 4948 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 1 ms 8792 KB Output is correct
18 Correct 1 ms 6744 KB Output is correct
19 Correct 1 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 2 ms 12912 KB Output is correct
4 Correct 1 ms 6744 KB Output is correct
5 Correct 2 ms 12888 KB Output is correct
6 Correct 2 ms 12884 KB Output is correct
7 Correct 2 ms 12888 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 2 ms 8792 KB Output is correct
15 Correct 1 ms 4948 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 1 ms 8792 KB Output is correct
18 Correct 1 ms 6744 KB Output is correct
19 Correct 1 ms 6744 KB Output is correct
20 Correct 1 ms 2648 KB Output is correct
21 Correct 2 ms 12912 KB Output is correct
22 Correct 4 ms 13144 KB Output is correct
23 Correct 1 ms 2904 KB Output is correct
24 Correct 22 ms 60168 KB Output is correct
25 Correct 9 ms 31320 KB Output is correct
26 Correct 5 ms 12960 KB Output is correct
27 Correct 15 ms 59992 KB Output is correct
28 Correct 10 ms 58200 KB Output is correct
29 Correct 14 ms 58632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 2 ms 12912 KB Output is correct
4 Correct 1 ms 6744 KB Output is correct
5 Correct 2 ms 12888 KB Output is correct
6 Correct 2 ms 12884 KB Output is correct
7 Correct 2 ms 12888 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 2 ms 8792 KB Output is correct
15 Correct 1 ms 4948 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 1 ms 8792 KB Output is correct
18 Correct 1 ms 6744 KB Output is correct
19 Correct 1 ms 6744 KB Output is correct
20 Correct 1 ms 2648 KB Output is correct
21 Correct 2 ms 12912 KB Output is correct
22 Correct 4 ms 13144 KB Output is correct
23 Correct 1 ms 2904 KB Output is correct
24 Correct 22 ms 60168 KB Output is correct
25 Correct 9 ms 31320 KB Output is correct
26 Correct 5 ms 12960 KB Output is correct
27 Correct 15 ms 59992 KB Output is correct
28 Correct 10 ms 58200 KB Output is correct
29 Correct 14 ms 58632 KB Output is correct
30 Correct 38 ms 13964 KB Output is correct
31 Correct 122 ms 118220 KB Output is correct
32 Correct 55 ms 14356 KB Output is correct
33 Correct 12 ms 3672 KB Output is correct
34 Correct 801 ms 119928 KB Output is correct
35 Correct 1031 ms 120128 KB Output is correct
36 Correct 116 ms 14880 KB Output is correct
37 Correct 1427 ms 119904 KB Output is correct
38 Correct 1403 ms 119572 KB Output is correct
39 Correct 1386 ms 119860 KB Output is correct
40 Correct 1040 ms 120556 KB Output is correct
41 Correct 901 ms 120016 KB Output is correct
42 Correct 887 ms 120284 KB Output is correct
43 Correct 1574 ms 120904 KB Output is correct
44 Correct 948 ms 120108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 2 ms 12912 KB Output is correct
4 Correct 1 ms 6744 KB Output is correct
5 Correct 2 ms 12888 KB Output is correct
6 Correct 2 ms 12884 KB Output is correct
7 Correct 2 ms 12888 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 2 ms 8792 KB Output is correct
15 Correct 1 ms 4948 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 1 ms 8792 KB Output is correct
18 Correct 1 ms 6744 KB Output is correct
19 Correct 1 ms 6744 KB Output is correct
20 Correct 1 ms 2648 KB Output is correct
21 Correct 2 ms 12912 KB Output is correct
22 Correct 4 ms 13144 KB Output is correct
23 Correct 1 ms 2904 KB Output is correct
24 Correct 22 ms 60168 KB Output is correct
25 Correct 9 ms 31320 KB Output is correct
26 Correct 5 ms 12960 KB Output is correct
27 Correct 15 ms 59992 KB Output is correct
28 Correct 10 ms 58200 KB Output is correct
29 Correct 14 ms 58632 KB Output is correct
30 Correct 38 ms 13964 KB Output is correct
31 Correct 122 ms 118220 KB Output is correct
32 Correct 55 ms 14356 KB Output is correct
33 Correct 12 ms 3672 KB Output is correct
34 Correct 801 ms 119928 KB Output is correct
35 Correct 1031 ms 120128 KB Output is correct
36 Correct 116 ms 14880 KB Output is correct
37 Correct 1427 ms 119904 KB Output is correct
38 Correct 1403 ms 119572 KB Output is correct
39 Correct 1386 ms 119860 KB Output is correct
40 Correct 1040 ms 120556 KB Output is correct
41 Correct 901 ms 120016 KB Output is correct
42 Correct 887 ms 120284 KB Output is correct
43 Correct 1574 ms 120904 KB Output is correct
44 Correct 948 ms 120108 KB Output is correct
45 Runtime error 13 ms 25684 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -