Submission #957580

# Submission time Handle Problem Language Result Execution time Memory
957580 2024-04-04T04:42:44 Z vjudge1 Game (APIO22_game) C++17
0 / 100
2 ms 7512 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 Incorrect 2 ms 7512 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Incorrect 2 ms 7512 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Incorrect 2 ms 7512 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Incorrect 2 ms 7512 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 7512 KB Output is correct
2 Incorrect 2 ms 7512 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -