Submission #966831

# Submission time Handle Problem Language Result Execution time Memory
966831 2024-04-20T12:57:25 Z josanneo22 Game (APIO22_game) C++17
Compilation error
0 ms 0 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

const int nax = 3005;
const int kax = 1005;
int reach[kax][nax], N, K;
vector<int> G[nax];
bool ok = false;

void dfs(int tp, int u) {
	if (reach[tp][u]) continue;
	raech[tp][u] = true;
	if (u <= tp) ok = true;
	for (auto & v : G[u]) {
		if (!reach[tp][v]) {
			dfs(tp, v);
		}
	}
}
void init(int n, int k) {
	N = n; K = k;
	for (int i = 1; i <= k - 1; i++) G[i].push_back(i + 1);
	for (int i = 1; i <= k; i++) dfs(i);
}
int add_teleporter(int u, int v) {
	u++; v++;
	G[u].push_back(v);
	for (int i = 1; i <= K; i++) {
		if (reach[i][u] && !reach[i][v]) {
			dfs(i, v);
		}
	}
	return ok;
}

Compilation message

game.cpp: In function 'void dfs(int, int)':
game.cpp:12:20: error: continue statement not within a loop
   12 |  if (reach[tp][u]) continue;
      |                    ^~~~~~~~
game.cpp:13:2: error: 'raech' was not declared in this scope; did you mean 'reach'?
   13 |  raech[tp][u] = true;
      |  ^~~~~
      |  reach
game.cpp: In function 'void init(int, int)':
game.cpp:24:36: error: too few arguments to function 'void dfs(int, int)'
   24 |  for (int i = 1; i <= k; i++) dfs(i);
      |                                    ^
game.cpp:11:6: note: declared here
   11 | void dfs(int tp, int u) {
      |      ^~~