Submission #577353

# Submission time Handle Problem Language Result Execution time Memory
577353 2022-06-14T15:16:48 Z handlename Game (APIO22_game) C++17
30 / 100
4000 ms 9112 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
const int MOD=1e9+7;
int n,k;
vector<int> adj[300001];
bool work;
bool vis[300001];
void init(int N,int K){
	n=N;
	k=K;
	work=false;
	for (int i=0;i<k-1;i++){
		adj[i].pb(i+1);
	}
}
void dfs(int x,int ori){
	if (x==ori) work=true;
	if (work) return;
	if (vis[x]) return;
	vis[x]=true;
	for (auto i:adj[x]){
		dfs(i,ori);
	}
}
int add_teleporter(int u,int v){
	adj[u].pb(v);
	for (int i=0;i<n;i++) vis[i]=false;
	for (int i=k-1;i>=0;i--){
		for (auto j:adj[i]){
			dfs(j,i);
			if (work) return 1;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7272 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7352 KB Output is correct
5 Correct 5 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 6 ms 7248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7272 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7352 KB Output is correct
5 Correct 5 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 6 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 3 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 5 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 4 ms 7236 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 6 ms 7248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7272 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7352 KB Output is correct
5 Correct 5 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 6 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 3 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 5 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 4 ms 7236 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 6 ms 7248 KB Output is correct
20 Correct 5 ms 7352 KB Output is correct
21 Correct 4 ms 7356 KB Output is correct
22 Correct 5 ms 7376 KB Output is correct
23 Correct 5 ms 7376 KB Output is correct
24 Correct 11 ms 7368 KB Output is correct
25 Correct 57 ms 7372 KB Output is correct
26 Correct 67 ms 7364 KB Output is correct
27 Correct 83 ms 7368 KB Output is correct
28 Correct 24 ms 7376 KB Output is correct
29 Correct 63 ms 7376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7272 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7352 KB Output is correct
5 Correct 5 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 6 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 3 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 5 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 4 ms 7236 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 6 ms 7248 KB Output is correct
20 Correct 5 ms 7352 KB Output is correct
21 Correct 4 ms 7356 KB Output is correct
22 Correct 5 ms 7376 KB Output is correct
23 Correct 5 ms 7376 KB Output is correct
24 Correct 11 ms 7368 KB Output is correct
25 Correct 57 ms 7372 KB Output is correct
26 Correct 67 ms 7364 KB Output is correct
27 Correct 83 ms 7368 KB Output is correct
28 Correct 24 ms 7376 KB Output is correct
29 Correct 63 ms 7376 KB Output is correct
30 Correct 153 ms 7836 KB Output is correct
31 Correct 84 ms 7580 KB Output is correct
32 Correct 86 ms 8692 KB Output is correct
33 Correct 58 ms 8276 KB Output is correct
34 Correct 1114 ms 9112 KB Output is correct
35 Execution timed out 4035 ms 8316 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7272 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7352 KB Output is correct
5 Correct 5 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 6 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 3 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 5 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 4 ms 7236 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 6 ms 7248 KB Output is correct
20 Correct 5 ms 7352 KB Output is correct
21 Correct 4 ms 7356 KB Output is correct
22 Correct 5 ms 7376 KB Output is correct
23 Correct 5 ms 7376 KB Output is correct
24 Correct 11 ms 7368 KB Output is correct
25 Correct 57 ms 7372 KB Output is correct
26 Correct 67 ms 7364 KB Output is correct
27 Correct 83 ms 7368 KB Output is correct
28 Correct 24 ms 7376 KB Output is correct
29 Correct 63 ms 7376 KB Output is correct
30 Correct 153 ms 7836 KB Output is correct
31 Correct 84 ms 7580 KB Output is correct
32 Correct 86 ms 8692 KB Output is correct
33 Correct 58 ms 8276 KB Output is correct
34 Correct 1114 ms 9112 KB Output is correct
35 Execution timed out 4035 ms 8316 KB Time limit exceeded
36 Halted 0 ms 0 KB -