Submission #422822

#TimeUsernameProblemLanguageResultExecution timeMemory
422822SSRSVision Program (IOI19_vision)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; void construct_network(int H, int W, int K){ if (K == 1){ int mx = H + W - 1; vector<vector<int>> id1(mx), id2(mx); for (int i = 0; i < H; i++){ for (int j = 0; j < W; j++){ id1[i + j].push_back(i * W + j); id2[i - j + (W - 1)].push_back(i * W + j); } } vector<int> a(mx), b(mx); for (int i = 0; i < mx; i++){ a[i] = add_or(id1[i]); b[i] = add_or(id2[i]); } vector<int> a2(mx - 1), b2(mx - 1); for (int i = 0; i < mx - 1; i++){ a2[i] = add_and({a[i], a[i + 1]}); b2[i] = add_and({b[i], b[i + 1]}); } int X = add_or(a2); int Y = add_or(b2); add_and({X, Y}); } else { vector<int> A; if (max(H, W) <= 30 || min(H, W) == 1){ for (int x1 = 0; x1 < H; x1++){ for (int y1 = 0; y1 < W; y1++){ for (int x2 = 0; x2 < H; x2++){ for (int y2 = 0; y2 < W; y2++){ if (abs(x2 - x1) + abs(y2 - y1) == K){ int a = x1 * W + y1; int b = x2 * W + y2; if (a < b){ vector<int> id = {a, b}; add_and(id); cnt++; } } } } } } } else { for (int x = 0; x < H; x++){ for (int y = 0; y < W; y++){ if (x + y == K){ int a = x * W + y; vector<int> id = {0, a}; add_and(id); cnt++; } } } } vector<int> id; for (int i = H * W; i < cnt; i++){ id.push_back(i); } add_or(id); } }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:40:19: error: 'cnt' was not declared in this scope; did you mean 'int'?
   40 |                   cnt++;
      |                   ^~~
      |                   int
vision.cpp:54:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   54 |             cnt++;
      |             ^~~
      |             int
vision.cpp:60:29: error: 'cnt' was not declared in this scope; did you mean 'int'?
   60 |     for (int i = H * W; i < cnt; i++){
      |                             ^~~
      |                             int