Submission #985294

# Submission time Handle Problem Language Result Execution time Memory
985294 2024-05-17T14:40:59 Z Aybak Game (APIO22_game) C++17
Compilation error
0 ms 0 KB
#include <cstdio>
#include <cstdlib>

#include <iostream>
#include <vector>
#include <string>


bool** arr;
int n;
int k;

/*
6 5 3
3 4
5 0
4 5
5 3
1 4
*/

void Print() {
	return;
	For(y, n) {
		For(x, n) {
			print(arr[x][y] << " "); }
		printl(""); }
	printl("-------------"); }

void init(int nH, int kH) {
	n = nH;
	k = kH;
	arr = new bool*[n];
	For(x, n) {
		For(y, n) {
			arr[x] = new bool[n]{}; } }
	For(x, k - 1) {
		for (int y = x + 1; y < k; ++y) {
			arr[x][y] = 1; } }
	Print();
}

void add(int x1, int x2) {
	bool change = 0;
	For(i, n) {
		if (arr[x2][i] == 1 && arr[x1][i] == 0) {
			change = 1;
			arr[x1][i] = arr[x1][i] || arr[x2][i]; } }
	if (change == 0) {
		return; }
	For(i, n) {
		if (arr[i][x1] == true) {
			add(i, x1); } } }

bool check() {
	For(x, k) {
		For(y, x + 1) {
			if (arr[x][y] == 1) {
				return 1; } } }
	return 0; }

int add_teleporter(int x, int y) {
	arr[x][y] = 1;
	add(x, y);
	Print();
	return check();
}

Compilation message

game.cpp: In function 'void Print()':
game.cpp:24:6: error: 'y' was not declared in this scope
   24 |  For(y, n) {
      |      ^
game.cpp:24:2: error: 'For' was not declared in this scope
   24 |  For(y, n) {
      |  ^~~
game.cpp:28:2: error: 'printl' was not declared in this scope; did you mean 'printf'?
   28 |  printl("-------------"); }
      |  ^~~~~~
      |  printf
game.cpp: In function 'void init(int, int)':
game.cpp:34:6: error: 'x' was not declared in this scope
   34 |  For(x, n) {
      |      ^
game.cpp:34:2: error: 'For' was not declared in this scope
   34 |  For(x, n) {
      |  ^~~
game.cpp: In function 'void add(int, int)':
game.cpp:45:6: error: 'i' was not declared in this scope
   45 |  For(i, n) {
      |      ^
game.cpp:45:2: error: 'For' was not declared in this scope
   45 |  For(i, n) {
      |  ^~~
game.cpp: In function 'bool check()':
game.cpp:56:6: error: 'x' was not declared in this scope
   56 |  For(x, k) {
      |      ^
game.cpp:56:2: error: 'For' was not declared in this scope
   56 |  For(x, k) {
      |  ^~~