Submission #349015

#TimeUsernameProblemLanguageResultExecution timeMemory
349015apostoldaniel854Furniture (JOI20_furniture)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back const int MAX_N = 1000; bool blocked[1 + MAX_N][1 + MAX_N]; void go_stupid (int x, int y) { if (x >= 1 && x <= n && y >= 1 && y <= m) { if (not blocked[x][y]) { blocked[x][y] = true; diag[x + y]--; if (blocked[x - 1][y + 1]) { go_stupid (x, y + 1); go_stupid (x - 1, y); } if (blocked[x + 1][y - 1]) { go_stupid (x, y - 1); go_stupid (x + 1, y); } } } } int main() { ios::sync_with_stdio (false); cin.tie (0); cout.tie (0); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { int x; cin >> x; if (x) diag[i + j]++; else go_stupid (i, j); } int q; cin >> q; while (q--) { int x, y; cin >> x >> y; if (blocked[x][y]) cout << "1\n"; else if (diag[x][y] == 1) cout << "0\n"; else { cout << "1\n"; go_stupid (x, y); } } return 0; }

Compilation message (stderr)

furniture.cpp: In function 'void go_stupid(int, int)':
furniture.cpp:10:24: error: 'n' was not declared in this scope
   10 |     if (x >= 1 && x <= n && y >= 1 && y <= m) {
      |                        ^
furniture.cpp:10:44: error: 'm' was not declared in this scope
   10 |     if (x >= 1 && x <= n && y >= 1 && y <= m) {
      |                                            ^
furniture.cpp:13:13: error: 'diag' was not declared in this scope
   13 |             diag[x + y]--;
      |             ^~~~
furniture.cpp: In function 'int main()':
furniture.cpp:35:17: error: 'diag' was not declared in this scope
   35 |                 diag[i + j]++;
      |                 ^~~~
furniture.cpp:46:18: error: 'diag' was not declared in this scope
   46 |         else if (diag[x][y] == 1)
      |                  ^~~~