#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K) {
//the 2 cells are in the same column iff the xors of each column is zero
//same for rows
//then for them to be adjacent, they must be say in the same column but in adjacent rows
//DIAGONAL INTERACTION FOR NEXT SUBTASKS
vector<int> row_xors;
for (int i=0; i<H; i++) {
vector<int> trial(W);
iota(trial.begin(), trial.end(), (int)(i*W));
row_xors.push_back(add_xor(trial));
}
vector<int> col_xors;
for (int j=0; j<W; j++) {
vector<int> trial(H);
for (int i=0; i<H; i++) trial[i] = i*W+j;
col_xors.push_back(add_xor(trial));
}
int final_COL = add_or(col_xors);
int final_ROW = add_or(row_xors);
vector<int> adjacent_rows;
for (int i=0; i<H-1; i++) {
adjacent_rows.push_back(add_and({row_xors[i], row_xors[i+1]}));
}
vector<int> adjacent_cols;
for (int i=0; i<W-1; i++) {
adjacent_cols.push_back(add_and({col_xors[i], col_xors[i+1]}));
}
int fin_adj_row = add_or(adjacent_rows);
int fin_adj_col = add_or(adjacent_cols);
int result = add_or({add_and({add_not({final_COL}), fin_adj_row}), add_and({add_not({final_ROW}), fin_adj_col})});
}