Submission #980543

# Submission time Handle Problem Language Result Execution time Memory
980543 2024-05-12T08:32:04 Z willychan Game (APIO22_game) C++17
60 / 100
3872 ms 262144 KB
#include "game.h"
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

vector<vector<bool> > reach;
vector<vector<int> > side;
void dfs(int cur,int k){
	reach[cur][k]=1;
	for(auto i : side[cur]){
		if(!reach[i][k]) dfs(i,k);
	}
}
int K;
int update(int u,int v){
	side[u].push_back(v);
	for(int i=0;i<K;i++){
		if(u==i || reach[u][i]) dfs(v,i);
		if(reach[i][i]) return 1;
	}
	return 0;
}

void init(int n, int k) {
	reach.resize(n);
	side.resize(n);
	for(int i=0;i<n;i++){
		reach[i].resize(k,0);
	}
	K=k;
	for(int i=0;i<k-1;i++){
		update(i,i+1);
	}
}



int add_teleporter(int u, int v) {
  return update(u,v);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 4 ms 600 KB Output is correct
25 Correct 4 ms 600 KB Output is correct
26 Correct 4 ms 344 KB Output is correct
27 Correct 11 ms 600 KB Output is correct
28 Correct 4 ms 600 KB Output is correct
29 Correct 7 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 4 ms 600 KB Output is correct
25 Correct 4 ms 600 KB Output is correct
26 Correct 4 ms 344 KB Output is correct
27 Correct 11 ms 600 KB Output is correct
28 Correct 4 ms 600 KB Output is correct
29 Correct 7 ms 600 KB Output is correct
30 Correct 18 ms 4084 KB Output is correct
31 Correct 22 ms 6992 KB Output is correct
32 Correct 39 ms 4896 KB Output is correct
33 Correct 17 ms 4384 KB Output is correct
34 Correct 555 ms 9368 KB Output is correct
35 Correct 313 ms 8428 KB Output is correct
36 Correct 74 ms 4708 KB Output is correct
37 Correct 361 ms 7872 KB Output is correct
38 Correct 257 ms 7988 KB Output is correct
39 Correct 274 ms 7556 KB Output is correct
40 Correct 558 ms 8868 KB Output is correct
41 Correct 294 ms 8216 KB Output is correct
42 Correct 210 ms 7832 KB Output is correct
43 Correct 594 ms 8672 KB Output is correct
44 Correct 522 ms 8852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 4 ms 600 KB Output is correct
25 Correct 4 ms 600 KB Output is correct
26 Correct 4 ms 344 KB Output is correct
27 Correct 11 ms 600 KB Output is correct
28 Correct 4 ms 600 KB Output is correct
29 Correct 7 ms 600 KB Output is correct
30 Correct 18 ms 4084 KB Output is correct
31 Correct 22 ms 6992 KB Output is correct
32 Correct 39 ms 4896 KB Output is correct
33 Correct 17 ms 4384 KB Output is correct
34 Correct 555 ms 9368 KB Output is correct
35 Correct 313 ms 8428 KB Output is correct
36 Correct 74 ms 4708 KB Output is correct
37 Correct 361 ms 7872 KB Output is correct
38 Correct 257 ms 7988 KB Output is correct
39 Correct 274 ms 7556 KB Output is correct
40 Correct 558 ms 8868 KB Output is correct
41 Correct 294 ms 8216 KB Output is correct
42 Correct 210 ms 7832 KB Output is correct
43 Correct 594 ms 8672 KB Output is correct
44 Correct 522 ms 8852 KB Output is correct
45 Correct 237 ms 34744 KB Output is correct
46 Correct 53 ms 62052 KB Output is correct
47 Correct 87 ms 99408 KB Output is correct
48 Correct 3872 ms 44032 KB Output is correct
49 Correct 266 ms 38472 KB Output is correct
50 Runtime error 113 ms 262144 KB Execution killed with signal 9
51 Halted 0 ms 0 KB -