Submission #982697

# Submission time Handle Problem Language Result Execution time Memory
982697 2024-05-14T16:13:18 Z vjudge1 Game (APIO22_game) C++17
12 / 100
4000 ms 12760 KB
#include "game.h"
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define fi first
#define se second
#define pii pair<int, int>
#define ll long long
#define pb push_back

using namespace std;

int N, K;
const int lim=5e5+5;
vector<int> adj[lim];
bool ans=false, vis[lim];

void init(int n, int k) {
	N=n; K=k;
}

void dfs(int u, int r){
	vis[u]=true;
	repa(v,adj[u]){
		if(!vis[v]) dfs(v,r);
		if(v==r || ans){
			ans=true;
			return;
		}
	}
	if(u<K-1) dfs(u+1,r); 
}

int add_teleporter(int u, int v) {
	adj[u].pb(v);
	if(ans) return 1;
	rep(i,0,K){
		fill(vis,vis+N,false);
		dfs(i,i);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 3 ms 12372 KB Output is correct
3 Correct 22 ms 12376 KB Output is correct
4 Correct 4 ms 12376 KB Output is correct
5 Correct 16 ms 12376 KB Output is correct
6 Correct 18 ms 12460 KB Output is correct
7 Correct 28 ms 12372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 3 ms 12372 KB Output is correct
3 Correct 22 ms 12376 KB Output is correct
4 Correct 4 ms 12376 KB Output is correct
5 Correct 16 ms 12376 KB Output is correct
6 Correct 18 ms 12460 KB Output is correct
7 Correct 28 ms 12372 KB Output is correct
8 Correct 3 ms 12376 KB Output is correct
9 Correct 3 ms 12376 KB Output is correct
10 Correct 3 ms 12376 KB Output is correct
11 Correct 3 ms 12376 KB Output is correct
12 Correct 3 ms 12376 KB Output is correct
13 Correct 3 ms 12376 KB Output is correct
14 Correct 4 ms 12476 KB Output is correct
15 Correct 5 ms 12376 KB Output is correct
16 Correct 3 ms 12376 KB Output is correct
17 Correct 8 ms 12376 KB Output is correct
18 Correct 3 ms 12376 KB Output is correct
19 Correct 5 ms 12376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 3 ms 12372 KB Output is correct
3 Correct 22 ms 12376 KB Output is correct
4 Correct 4 ms 12376 KB Output is correct
5 Correct 16 ms 12376 KB Output is correct
6 Correct 18 ms 12460 KB Output is correct
7 Correct 28 ms 12372 KB Output is correct
8 Correct 3 ms 12376 KB Output is correct
9 Correct 3 ms 12376 KB Output is correct
10 Correct 3 ms 12376 KB Output is correct
11 Correct 3 ms 12376 KB Output is correct
12 Correct 3 ms 12376 KB Output is correct
13 Correct 3 ms 12376 KB Output is correct
14 Correct 4 ms 12476 KB Output is correct
15 Correct 5 ms 12376 KB Output is correct
16 Correct 3 ms 12376 KB Output is correct
17 Correct 8 ms 12376 KB Output is correct
18 Correct 3 ms 12376 KB Output is correct
19 Correct 5 ms 12376 KB Output is correct
20 Correct 5 ms 12376 KB Output is correct
21 Correct 5 ms 12480 KB Output is correct
22 Correct 12 ms 12500 KB Output is correct
23 Correct 3 ms 12376 KB Output is correct
24 Correct 1132 ms 12524 KB Output is correct
25 Execution timed out 4054 ms 12760 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 3 ms 12372 KB Output is correct
3 Correct 22 ms 12376 KB Output is correct
4 Correct 4 ms 12376 KB Output is correct
5 Correct 16 ms 12376 KB Output is correct
6 Correct 18 ms 12460 KB Output is correct
7 Correct 28 ms 12372 KB Output is correct
8 Correct 3 ms 12376 KB Output is correct
9 Correct 3 ms 12376 KB Output is correct
10 Correct 3 ms 12376 KB Output is correct
11 Correct 3 ms 12376 KB Output is correct
12 Correct 3 ms 12376 KB Output is correct
13 Correct 3 ms 12376 KB Output is correct
14 Correct 4 ms 12476 KB Output is correct
15 Correct 5 ms 12376 KB Output is correct
16 Correct 3 ms 12376 KB Output is correct
17 Correct 8 ms 12376 KB Output is correct
18 Correct 3 ms 12376 KB Output is correct
19 Correct 5 ms 12376 KB Output is correct
20 Correct 5 ms 12376 KB Output is correct
21 Correct 5 ms 12480 KB Output is correct
22 Correct 12 ms 12500 KB Output is correct
23 Correct 3 ms 12376 KB Output is correct
24 Correct 1132 ms 12524 KB Output is correct
25 Execution timed out 4054 ms 12760 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 3 ms 12372 KB Output is correct
3 Correct 22 ms 12376 KB Output is correct
4 Correct 4 ms 12376 KB Output is correct
5 Correct 16 ms 12376 KB Output is correct
6 Correct 18 ms 12460 KB Output is correct
7 Correct 28 ms 12372 KB Output is correct
8 Correct 3 ms 12376 KB Output is correct
9 Correct 3 ms 12376 KB Output is correct
10 Correct 3 ms 12376 KB Output is correct
11 Correct 3 ms 12376 KB Output is correct
12 Correct 3 ms 12376 KB Output is correct
13 Correct 3 ms 12376 KB Output is correct
14 Correct 4 ms 12476 KB Output is correct
15 Correct 5 ms 12376 KB Output is correct
16 Correct 3 ms 12376 KB Output is correct
17 Correct 8 ms 12376 KB Output is correct
18 Correct 3 ms 12376 KB Output is correct
19 Correct 5 ms 12376 KB Output is correct
20 Correct 5 ms 12376 KB Output is correct
21 Correct 5 ms 12480 KB Output is correct
22 Correct 12 ms 12500 KB Output is correct
23 Correct 3 ms 12376 KB Output is correct
24 Correct 1132 ms 12524 KB Output is correct
25 Execution timed out 4054 ms 12760 KB Time limit exceeded
26 Halted 0 ms 0 KB -