#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
void AND() {
add_and(v);
v.clear();
}
void XOR() {
add_xor(v);
v.clear();
}
void OR() {
add_or(v);
v.clear();
}
void construct_network(int H, int W, int K) {
int T = H * W;
auto get = [&](int x, int y) {
return x * W + y;
};
vector<int> v;
if (min(H, W) == 1) {
if (H != 1) {
swap(H, W);
}
for (int i = 0; i + K < W; i++) {
add_and({i, i + K});
v.push_back(T++);
}
OR(v);
return;
}
if (K == 1) {
vector<int> A(H);
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
v.push_back(get(i, j));
}
A[i] = T++;
OR(v);
}
vector<int> B(W);
for (int j = 0; j < W; j++) {
for (int i = 0; i < H; i++) {
v.push_back(get(i, j));
}
B[j] = T++;
OR(v);
}
vector<int> C(H - 1);
for (int i = 0; i + 1 < H; i++) {
C[i] = T++;
add_and({A[i], A[i + 1]});
}
vector<int> D(W - 1);
for (int i = 0; i + 1 < W; i++) {
D[i] = T++;
add_and({B[i], B[i + 1]});
}
for (int i = 0; i < H; i++) {
v.push_back(A[i]);
}
int x = T++;
XOR(v);
for (int i = 0; i + 1 < W; i++) {
v.push_back(D[i]);
}
int y = T++;
OR(v);
int z = T++;
add_and({x, y});
for (int i = 0; i < W; i++) {
v.push_back(B[i]);
}
int a = T++;
XOR(v);
for (int i = 0; i + 1 < H; i++) {
v.push_back(C[i]);
}
int b = T++;
OR(v);
int c = T++;
add_add({a, b});
add_or({z, c});
return;
}
for (int i = 0; i <= K; i++) {
if (i < H && K - i < W) {
add_and({0, get(i, K - i)});
v.push_back(T++);
}
}
OR(v);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:31:7: error: too many arguments to function 'void OR()'
31 | OR(v);
| ^
vision.cpp:13:6: note: declared here
13 | void OR() {
| ^~
vision.cpp:41:8: error: too many arguments to function 'void OR()'
41 | OR(v);
| ^
vision.cpp:13:6: note: declared here
13 | void OR() {
| ^~
vision.cpp:49:8: error: too many arguments to function 'void OR()'
49 | OR(v);
| ^
vision.cpp:13:6: note: declared here
13 | void OR() {
| ^~
vision.cpp:65:8: error: too many arguments to function 'void XOR()'
65 | XOR(v);
| ^
vision.cpp:9:6: note: declared here
9 | void XOR() {
| ^~~
vision.cpp:70:7: error: too many arguments to function 'void OR()'
70 | OR(v);
| ^
vision.cpp:13:6: note: declared here
13 | void OR() {
| ^~
vision.cpp:77:8: error: too many arguments to function 'void XOR()'
77 | XOR(v);
| ^
vision.cpp:9:6: note: declared here
9 | void XOR() {
| ^~~
vision.cpp:82:7: error: too many arguments to function 'void OR()'
82 | OR(v);
| ^
vision.cpp:13:6: note: declared here
13 | void OR() {
| ^~
vision.cpp:84:3: error: 'add_add' was not declared in this scope; did you mean 'add_and'?
84 | add_add({a, b});
| ^~~~~~~
| add_and
vision.cpp:94:6: error: too many arguments to function 'void OR()'
94 | OR(v);
| ^
vision.cpp:13:6: note: declared here
13 | void OR() {
| ^~