제출 #985294

#제출 시각아이디문제언어결과실행 시간메모리
985294Aybak게임 (APIO22_game)C++17
컴파일 에러
0 ms0 KiB
#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(); }

컴파일 시 표준 에러 (stderr) 메시지

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) {
      |  ^~~