#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7, MOD2 = 1e6 + 3;
int a[100000], k, t, H, W, K;
struct data {
struct segment {
int l, r;
} prim, weak, sec;
int prim_res, sec_res, zero, shortcut, l, r;
} diag, antid;
vector <int> tie (int a, int b)
{
vector <int> c;
c.push_back (a);
c.push_back (b);
return c;
}
void process (data& diag, bool rev, int H, int W, int K) {
vector <int> v;
diag.l = t;
for (int i = (rev ? 0 : -H + 1); i < (rev ? W + H - 1 : W); i++) {
v.clear ();
for (int j = 0; j < H; j++) {
int ji = (rev ? i - j : j + i);
if (0 <= ji && ji < W) {
v.push_back (j * W + ji);
}
}
t++;
add_xor (v);
}
diag.r = t;
diag.prim.l = t;
for (int i = diag.l; i < diag.r; i++) {
if (i - K >= diag.l) {
add_and (tie (i - K, i));
t++;
}
}
diag.prim.r = t;
v.clear ();
for (int i = diag.l; i < diag.r; i++) {
v.push_back (i);
}
diag.shortcut = t + 1;
add_or (v);
add_not (t);
t += 2;
diag.zero = t;
add_xor (tie (0, 0));
t++;
diag.weak.l = t;
for (int i = diag.l; i < diag.r; i++) {
v.clear ();
for (int j = max (diag.l, i - K); j < min (diag.r, i + K + 1); j++) {
if (j != i) v.push_back (j);
else v.push_back (diag.zero);
}
add_or (v);
t++;
}
diag.weak.r = t;
diag.sec.l = t;
for (int i = 0; i < diag.r - diag.l; i++) {
add_and (tie (diag.l + i, diag.weak.l + i));
t++;
}
diag.sec.r = t;
v.clear ();
diag.prim_res = t;
for (int i = diag.prim.l; i < diag.prim.r; i++) {
v.push_back (i);
}
add_or (v);
t++;
v.clear ();
diag.sec_res = t + 1;
for (int i = diag.sec.l; i < diag.sec.r; i++) {
v.push_back (i);
}
v.push_back (diag.shortcut);
add_or (v);
t++;
}
void construct_network (int H, int W, int K) {
t = H * W;
process (diag, false, H, W, K);
process (antid, true, H, W, K);
add_and (tie (diag.prim_res, antid.sec_res));
int primsec = t;
t++;
add_and (tie (antid.prim_res, diag.sec_res));
int secprim = t;
t++;
add_or (tie (primsec, secprim));
t++;
}
Compilation message
vision.cpp: In function 'void process(data&, bool, int, int, int)':
vision.cpp:52:3: error: 'add_xor' was not declared in this scope
add_xor (v);
^~~~~~~
vision.cpp:59:4: error: 'add_and' was not declared in this scope
add_and (tie (i - K, i));
^~~~~~~
vision.cpp:71:2: error: 'add_or' was not declared in this scope
add_or (v);
^~~~~~
vision.cpp:71:2: note: suggested alternative: 'rand_r'
add_or (v);
^~~~~~
rand_r
vision.cpp:72:2: error: 'add_not' was not declared in this scope
add_not (t);
^~~~~~~
vision.cpp:76:2: error: 'add_xor' was not declared in this scope
add_xor (tie (0, 0));
^~~~~~~
vision.cpp:93:3: error: 'add_and' was not declared in this scope
add_and (tie (diag.l + i, diag.weak.l + i));
^~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:123:2: error: 'add_and' was not declared in this scope
add_and (tie (diag.prim_res, antid.sec_res));
^~~~~~~
vision.cpp:131:2: error: 'add_or' was not declared in this scope
add_or (tie (primsec, secprim));
^~~~~~
vision.cpp:131:2: note: suggested alternative: 'rand_r'
add_or (tie (primsec, secprim));
^~~~~~
rand_r