Submission #704509

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

vector<int> adj[300000];
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[300000];
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 5 ms 8400 KB Output is correct
2 Correct 7 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 8 ms 8400 KB Output is correct
5 Correct 13 ms 8516 KB Output is correct
6 Correct 14 ms 8400 KB Output is correct
7 Correct 13 ms 8456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8400 KB Output is correct
2 Correct 7 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 8 ms 8400 KB Output is correct
5 Correct 13 ms 8516 KB Output is correct
6 Correct 14 ms 8400 KB Output is correct
7 Correct 13 ms 8456 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 6 ms 8400 KB Output is correct
10 Correct 5 ms 8400 KB Output is correct
11 Correct 8 ms 8520 KB Output is correct
12 Correct 8 ms 8400 KB Output is correct
13 Correct 7 ms 8512 KB Output is correct
14 Correct 7 ms 8400 KB Output is correct
15 Correct 11 ms 8524 KB Output is correct
16 Correct 11 ms 8400 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 8 ms 8400 KB Output is correct
19 Correct 9 ms 8400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8400 KB Output is correct
2 Correct 7 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 8 ms 8400 KB Output is correct
5 Correct 13 ms 8516 KB Output is correct
6 Correct 14 ms 8400 KB Output is correct
7 Correct 13 ms 8456 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 6 ms 8400 KB Output is correct
10 Correct 5 ms 8400 KB Output is correct
11 Correct 8 ms 8520 KB Output is correct
12 Correct 8 ms 8400 KB Output is correct
13 Correct 7 ms 8512 KB Output is correct
14 Correct 7 ms 8400 KB Output is correct
15 Correct 11 ms 8524 KB Output is correct
16 Correct 11 ms 8400 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 8 ms 8400 KB Output is correct
19 Correct 9 ms 8400 KB Output is correct
20 Correct 32 ms 8488 KB Output is correct
21 Correct 10 ms 8444 KB Output is correct
22 Correct 38 ms 8528 KB Output is correct
23 Correct 38 ms 8532 KB Output is correct
24 Correct 45 ms 8564 KB Output is correct
25 Correct 178 ms 8672 KB Output is correct
26 Correct 203 ms 8548 KB Output is correct
27 Correct 173 ms 8564 KB Output is correct
28 Correct 84 ms 8528 KB Output is correct
29 Correct 160 ms 8552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8400 KB Output is correct
2 Correct 7 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 8 ms 8400 KB Output is correct
5 Correct 13 ms 8516 KB Output is correct
6 Correct 14 ms 8400 KB Output is correct
7 Correct 13 ms 8456 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 6 ms 8400 KB Output is correct
10 Correct 5 ms 8400 KB Output is correct
11 Correct 8 ms 8520 KB Output is correct
12 Correct 8 ms 8400 KB Output is correct
13 Correct 7 ms 8512 KB Output is correct
14 Correct 7 ms 8400 KB Output is correct
15 Correct 11 ms 8524 KB Output is correct
16 Correct 11 ms 8400 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 8 ms 8400 KB Output is correct
19 Correct 9 ms 8400 KB Output is correct
20 Correct 32 ms 8488 KB Output is correct
21 Correct 10 ms 8444 KB Output is correct
22 Correct 38 ms 8528 KB Output is correct
23 Correct 38 ms 8532 KB Output is correct
24 Correct 45 ms 8564 KB Output is correct
25 Correct 178 ms 8672 KB Output is correct
26 Correct 203 ms 8548 KB Output is correct
27 Correct 173 ms 8564 KB Output is correct
28 Correct 84 ms 8528 KB Output is correct
29 Correct 160 ms 8552 KB Output is correct
30 Correct 1101 ms 9180 KB Output is correct
31 Correct 312 ms 8832 KB Output is correct
32 Correct 1018 ms 10284 KB Output is correct
33 Correct 883 ms 9732 KB Output is correct
34 Correct 2124 ms 10820 KB Output is correct
35 Execution timed out 4043 ms 9244 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8400 KB Output is correct
2 Correct 7 ms 8400 KB Output is correct
3 Correct 13 ms 8400 KB Output is correct
4 Correct 8 ms 8400 KB Output is correct
5 Correct 13 ms 8516 KB Output is correct
6 Correct 14 ms 8400 KB Output is correct
7 Correct 13 ms 8456 KB Output is correct
8 Correct 4 ms 8400 KB Output is correct
9 Correct 6 ms 8400 KB Output is correct
10 Correct 5 ms 8400 KB Output is correct
11 Correct 8 ms 8520 KB Output is correct
12 Correct 8 ms 8400 KB Output is correct
13 Correct 7 ms 8512 KB Output is correct
14 Correct 7 ms 8400 KB Output is correct
15 Correct 11 ms 8524 KB Output is correct
16 Correct 11 ms 8400 KB Output is correct
17 Correct 14 ms 8400 KB Output is correct
18 Correct 8 ms 8400 KB Output is correct
19 Correct 9 ms 8400 KB Output is correct
20 Correct 32 ms 8488 KB Output is correct
21 Correct 10 ms 8444 KB Output is correct
22 Correct 38 ms 8528 KB Output is correct
23 Correct 38 ms 8532 KB Output is correct
24 Correct 45 ms 8564 KB Output is correct
25 Correct 178 ms 8672 KB Output is correct
26 Correct 203 ms 8548 KB Output is correct
27 Correct 173 ms 8564 KB Output is correct
28 Correct 84 ms 8528 KB Output is correct
29 Correct 160 ms 8552 KB Output is correct
30 Correct 1101 ms 9180 KB Output is correct
31 Correct 312 ms 8832 KB Output is correct
32 Correct 1018 ms 10284 KB Output is correct
33 Correct 883 ms 9732 KB Output is correct
34 Correct 2124 ms 10820 KB Output is correct
35 Execution timed out 4043 ms 9244 KB Time limit exceeded
36 Halted 0 ms 0 KB -