#include <bits/stdc++.h>
#include "vision.h"
template <class T> using Vec = std::vector<T>;
template <class... Args>
Vec<int> vec(Args&&... args) {
return Vec<int>{std::forward<Args>(args)...};
}
void construct_network(int H, int W, int K) {
const auto inside = [&](const int i, const int j) {
return 0 <= i and i < H and 0 <= j and j < W;
};
const int L = H + W - 1;
Vec<Vec<int>> Xs(L), Ys(L);
for (int i = 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
Xs[i + j].push_back(cell(i, j));
Ys[i - j + W - 1].push_back(cell(i, j));
}
}
Vec<int> row(L), col(L), rowcum(L), colcum(L);
for (int i = 0; i < L; ++i) {
row[i] = add_or(Xs[i]);
col[i] = add_or(Ys[i]);
if (i == 0) {
rowcum[i] = row[i];
colcum[i] = col[i];
} else {
rowcum[i] = add_or(vec(rowcum[i - 1], row[i]));
colcum[i] = add_or(vec(colcum[i - 1], col[i]));
}
}
const auto calc = [&](const int D) {
Vec<int> memo;
for (int i = 0; i < L; ++i) {
if (i - D >= 0) {
memo.push_back(add_and(vec(row[i], rowcum[i - D])));
memo.push_back(add_and(vec(col[i], colcum[i - D])));
}
}
return add_or(memo);
};
const int cand = calc(K);
if (K + 1 != L) {
add_xor(vec(cand, calc(K + 1)));
}
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:19:24: error: 'cell' was not declared in this scope; did you mean 'ceill'?
19 | Xs[i + j].push_back(cell(i, j));
| ^~~~
| ceill