Submission #957584

# Submission time Handle Problem Language Result Execution time Memory
957584 2024-04-04T04:45:06 Z vjudge1 Game (APIO22_game) C++17
12 / 100
4000 ms 7860 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> g[300005];

int n, k;

void init(int _n, int _k) {
	n = _n;
	k = _k;
	for(int i = 1; i < k; ++i) {
		g[i-1].push_back(i);
	}
}

bool used[300005], ok;
int root;

void dfs(int v) {
	used[v] = 1;
	for(auto to : g[v]) {
		if(!used[to]) {
			dfs(to);
		}
	}
}

int add_teleporter(int u, int v) {
	if(v<=u && u<k) {
		return 1;
	}
	g[u].push_back(v);
  	for(int i = 0; i < k; ++i) {
  		fill(used, used+n, 0);
  		dfs(i);	
		for(int j = 0; j < n; ++j) {
			if(used[j]) {
				for(auto to : g[j]) {
					if(to == i) {
						return 1;
					}
				}
			}
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7764 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7596 KB Output is correct
4 Correct 5 ms 7512 KB Output is correct
5 Correct 18 ms 7512 KB Output is correct
6 Correct 17 ms 7512 KB Output is correct
7 Correct 18 ms 7512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7764 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7596 KB Output is correct
4 Correct 5 ms 7512 KB Output is correct
5 Correct 18 ms 7512 KB Output is correct
6 Correct 17 ms 7512 KB Output is correct
7 Correct 18 ms 7512 KB Output is correct
8 Correct 2 ms 7512 KB Output is correct
9 Correct 2 ms 7512 KB Output is correct
10 Correct 2 ms 7512 KB Output is correct
11 Correct 2 ms 7512 KB Output is correct
12 Correct 2 ms 7512 KB Output is correct
13 Correct 2 ms 7756 KB Output is correct
14 Correct 3 ms 7512 KB Output is correct
15 Correct 4 ms 7512 KB Output is correct
16 Correct 3 ms 7512 KB Output is correct
17 Correct 9 ms 7512 KB Output is correct
18 Correct 4 ms 7512 KB Output is correct
19 Correct 5 ms 7396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7764 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7596 KB Output is correct
4 Correct 5 ms 7512 KB Output is correct
5 Correct 18 ms 7512 KB Output is correct
6 Correct 17 ms 7512 KB Output is correct
7 Correct 18 ms 7512 KB Output is correct
8 Correct 2 ms 7512 KB Output is correct
9 Correct 2 ms 7512 KB Output is correct
10 Correct 2 ms 7512 KB Output is correct
11 Correct 2 ms 7512 KB Output is correct
12 Correct 2 ms 7512 KB Output is correct
13 Correct 2 ms 7756 KB Output is correct
14 Correct 3 ms 7512 KB Output is correct
15 Correct 4 ms 7512 KB Output is correct
16 Correct 3 ms 7512 KB Output is correct
17 Correct 9 ms 7512 KB Output is correct
18 Correct 4 ms 7512 KB Output is correct
19 Correct 5 ms 7396 KB Output is correct
20 Correct 12 ms 7596 KB Output is correct
21 Correct 16 ms 7772 KB Output is correct
22 Correct 96 ms 7852 KB Output is correct
23 Correct 13 ms 7512 KB Output is correct
24 Correct 1322 ms 7764 KB Output is correct
25 Execution timed out 4021 ms 7860 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7764 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7596 KB Output is correct
4 Correct 5 ms 7512 KB Output is correct
5 Correct 18 ms 7512 KB Output is correct
6 Correct 17 ms 7512 KB Output is correct
7 Correct 18 ms 7512 KB Output is correct
8 Correct 2 ms 7512 KB Output is correct
9 Correct 2 ms 7512 KB Output is correct
10 Correct 2 ms 7512 KB Output is correct
11 Correct 2 ms 7512 KB Output is correct
12 Correct 2 ms 7512 KB Output is correct
13 Correct 2 ms 7756 KB Output is correct
14 Correct 3 ms 7512 KB Output is correct
15 Correct 4 ms 7512 KB Output is correct
16 Correct 3 ms 7512 KB Output is correct
17 Correct 9 ms 7512 KB Output is correct
18 Correct 4 ms 7512 KB Output is correct
19 Correct 5 ms 7396 KB Output is correct
20 Correct 12 ms 7596 KB Output is correct
21 Correct 16 ms 7772 KB Output is correct
22 Correct 96 ms 7852 KB Output is correct
23 Correct 13 ms 7512 KB Output is correct
24 Correct 1322 ms 7764 KB Output is correct
25 Execution timed out 4021 ms 7860 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7764 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7596 KB Output is correct
4 Correct 5 ms 7512 KB Output is correct
5 Correct 18 ms 7512 KB Output is correct
6 Correct 17 ms 7512 KB Output is correct
7 Correct 18 ms 7512 KB Output is correct
8 Correct 2 ms 7512 KB Output is correct
9 Correct 2 ms 7512 KB Output is correct
10 Correct 2 ms 7512 KB Output is correct
11 Correct 2 ms 7512 KB Output is correct
12 Correct 2 ms 7512 KB Output is correct
13 Correct 2 ms 7756 KB Output is correct
14 Correct 3 ms 7512 KB Output is correct
15 Correct 4 ms 7512 KB Output is correct
16 Correct 3 ms 7512 KB Output is correct
17 Correct 9 ms 7512 KB Output is correct
18 Correct 4 ms 7512 KB Output is correct
19 Correct 5 ms 7396 KB Output is correct
20 Correct 12 ms 7596 KB Output is correct
21 Correct 16 ms 7772 KB Output is correct
22 Correct 96 ms 7852 KB Output is correct
23 Correct 13 ms 7512 KB Output is correct
24 Correct 1322 ms 7764 KB Output is correct
25 Execution timed out 4021 ms 7860 KB Time limit exceeded
26 Halted 0 ms 0 KB -