Submission #704507

# Submission time Handle Problem Language Result Execution time Memory
704507 2023-03-02T08:27:00 Z josanneo22 Game (APIO22_game) C++17
30 / 100
4000 ms 10808 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> adj[300006];
int n, k;
void init(int N, int K) {
	n = N; k = K;
	for(int i=0;i<k-1;i++) adj[i].push_back(i + 1);
}

int vis[300006];
bool dfs(int i) {
	if (vis[i] == 2) return true;
	if (vis[i] == 1) return i >= k;
	vis[i] = 1;
	for(auto j:adj[i])
	{
		if (!dfs(j)) return false;
	}
	vis[i] = 2;
	return true;
}

int add_teleporter(int u, int v)
{
	memset(vis, 0, sizeof(vis));
	adj[u].push_back(v);
	bool ok = dfs(0);
	return ok ? 0 : 1;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8448 KB Output is correct
2 Correct 5 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 10 ms 8400 KB Output is correct
5 Correct 13 ms 8400 KB Output is correct
6 Correct 13 ms 8396 KB Output is correct
7 Correct 12 ms 8400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8448 KB Output is correct
2 Correct 5 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 10 ms 8400 KB Output is correct
5 Correct 13 ms 8400 KB Output is correct
6 Correct 13 ms 8396 KB Output is correct
7 Correct 12 ms 8400 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 4 ms 8400 KB Output is correct
10 Correct 4 ms 8400 KB Output is correct
11 Correct 7 ms 8520 KB Output is correct
12 Correct 7 ms 8400 KB Output is correct
13 Correct 8 ms 8528 KB Output is correct
14 Correct 9 ms 8528 KB Output is correct
15 Correct 11 ms 8400 KB Output is correct
16 Correct 12 ms 8512 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 9 ms 8492 KB Output is correct
19 Correct 10 ms 8512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8448 KB Output is correct
2 Correct 5 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 10 ms 8400 KB Output is correct
5 Correct 13 ms 8400 KB Output is correct
6 Correct 13 ms 8396 KB Output is correct
7 Correct 12 ms 8400 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 4 ms 8400 KB Output is correct
10 Correct 4 ms 8400 KB Output is correct
11 Correct 7 ms 8520 KB Output is correct
12 Correct 7 ms 8400 KB Output is correct
13 Correct 8 ms 8528 KB Output is correct
14 Correct 9 ms 8528 KB Output is correct
15 Correct 11 ms 8400 KB Output is correct
16 Correct 12 ms 8512 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 9 ms 8492 KB Output is correct
19 Correct 10 ms 8512 KB Output is correct
20 Correct 36 ms 8508 KB Output is correct
21 Correct 8 ms 8520 KB Output is correct
22 Correct 29 ms 8532 KB Output is correct
23 Correct 34 ms 8532 KB Output is correct
24 Correct 40 ms 8572 KB Output is correct
25 Correct 181 ms 8556 KB Output is correct
26 Correct 184 ms 8552 KB Output is correct
27 Correct 191 ms 8552 KB Output is correct
28 Correct 88 ms 8552 KB Output is correct
29 Correct 161 ms 8556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8448 KB Output is correct
2 Correct 5 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 10 ms 8400 KB Output is correct
5 Correct 13 ms 8400 KB Output is correct
6 Correct 13 ms 8396 KB Output is correct
7 Correct 12 ms 8400 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 4 ms 8400 KB Output is correct
10 Correct 4 ms 8400 KB Output is correct
11 Correct 7 ms 8520 KB Output is correct
12 Correct 7 ms 8400 KB Output is correct
13 Correct 8 ms 8528 KB Output is correct
14 Correct 9 ms 8528 KB Output is correct
15 Correct 11 ms 8400 KB Output is correct
16 Correct 12 ms 8512 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 9 ms 8492 KB Output is correct
19 Correct 10 ms 8512 KB Output is correct
20 Correct 36 ms 8508 KB Output is correct
21 Correct 8 ms 8520 KB Output is correct
22 Correct 29 ms 8532 KB Output is correct
23 Correct 34 ms 8532 KB Output is correct
24 Correct 40 ms 8572 KB Output is correct
25 Correct 181 ms 8556 KB Output is correct
26 Correct 184 ms 8552 KB Output is correct
27 Correct 191 ms 8552 KB Output is correct
28 Correct 88 ms 8552 KB Output is correct
29 Correct 161 ms 8556 KB Output is correct
30 Correct 1027 ms 9080 KB Output is correct
31 Correct 307 ms 8804 KB Output is correct
32 Correct 1029 ms 10088 KB Output is correct
33 Correct 947 ms 9360 KB Output is correct
34 Correct 2252 ms 10808 KB Output is correct
35 Execution timed out 4008 ms 9472 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8448 KB Output is correct
2 Correct 5 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 10 ms 8400 KB Output is correct
5 Correct 13 ms 8400 KB Output is correct
6 Correct 13 ms 8396 KB Output is correct
7 Correct 12 ms 8400 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 4 ms 8400 KB Output is correct
10 Correct 4 ms 8400 KB Output is correct
11 Correct 7 ms 8520 KB Output is correct
12 Correct 7 ms 8400 KB Output is correct
13 Correct 8 ms 8528 KB Output is correct
14 Correct 9 ms 8528 KB Output is correct
15 Correct 11 ms 8400 KB Output is correct
16 Correct 12 ms 8512 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 9 ms 8492 KB Output is correct
19 Correct 10 ms 8512 KB Output is correct
20 Correct 36 ms 8508 KB Output is correct
21 Correct 8 ms 8520 KB Output is correct
22 Correct 29 ms 8532 KB Output is correct
23 Correct 34 ms 8532 KB Output is correct
24 Correct 40 ms 8572 KB Output is correct
25 Correct 181 ms 8556 KB Output is correct
26 Correct 184 ms 8552 KB Output is correct
27 Correct 191 ms 8552 KB Output is correct
28 Correct 88 ms 8552 KB Output is correct
29 Correct 161 ms 8556 KB Output is correct
30 Correct 1027 ms 9080 KB Output is correct
31 Correct 307 ms 8804 KB Output is correct
32 Correct 1029 ms 10088 KB Output is correct
33 Correct 947 ms 9360 KB Output is correct
34 Correct 2252 ms 10808 KB Output is correct
35 Execution timed out 4008 ms 9472 KB Time limit exceeded
36 Halted 0 ms 0 KB -