Submission #957582

# Submission time Handle Problem Language Result Execution time Memory
957582 2024-04-04T04:44:20 Z vjudge1 Game (APIO22_game) C++17
2 / 100
18 ms 7668 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 && v<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 7512 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7512 KB Output is correct
4 Correct 3 ms 7512 KB Output is correct
5 Correct 17 ms 7512 KB Output is correct
6 Correct 17 ms 7524 KB Output is correct
7 Correct 18 ms 7668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7512 KB Output is correct
4 Correct 3 ms 7512 KB Output is correct
5 Correct 17 ms 7512 KB Output is correct
6 Correct 17 ms 7524 KB Output is correct
7 Correct 18 ms 7668 KB Output is correct
8 Incorrect 2 ms 7512 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7512 KB Output is correct
4 Correct 3 ms 7512 KB Output is correct
5 Correct 17 ms 7512 KB Output is correct
6 Correct 17 ms 7524 KB Output is correct
7 Correct 18 ms 7668 KB Output is correct
8 Incorrect 2 ms 7512 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7512 KB Output is correct
4 Correct 3 ms 7512 KB Output is correct
5 Correct 17 ms 7512 KB Output is correct
6 Correct 17 ms 7524 KB Output is correct
7 Correct 18 ms 7668 KB Output is correct
8 Incorrect 2 ms 7512 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Correct 2 ms 7512 KB Output is correct
3 Correct 18 ms 7512 KB Output is correct
4 Correct 3 ms 7512 KB Output is correct
5 Correct 17 ms 7512 KB Output is correct
6 Correct 17 ms 7524 KB Output is correct
7 Correct 18 ms 7668 KB Output is correct
8 Incorrect 2 ms 7512 KB Wrong Answer[1]
9 Halted 0 ms 0 KB -