Submission #622534

# Submission time Handle Problem Language Result Execution time Memory
622534 2022-08-04T11:05:33 Z gromperen Game (APIO22_game) C++17
0 / 100
1 ms 208 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> adj;
vector<int> vis;
int n;
int k;

void init(int nn, int kk) {
	n = nn;
	k = kk;
	adj.resize(n);
	for (int i = 0; i < k-1; ++i) {
		adj[i].push_back(i+1);
	}
}

bool dfs(int u) {
	if (vis[u] && u < k) return 1;
	vis[u] = 1;
	for (int v : adj[u]) {
		if (vis[v] && v < k) return 1;
		if (!vis[v] && dfs(v)) return 1;
	}
	return 0;
}

int add_teleporter(int u, int v) {
	vis.assign(n, 0);
	adj[u].push_back(v);
	return dfs(0);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -