#include<bits/stdc++.h>
using namespace std;
#define ll int
#define pll pair<ll,ll>
#define ff first
#define ss second
//#define endl "\n"
#define pb push_back
#define F(i,a,b) for(ll i=a;i<=b;i++)
const ll maxn=5e5+100;
const ll base=1000;
const ll mod= 1e9+7 ;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
/// i believe myself
/// goal 2/8
//#include "vision.h"
vector<ll> gr[maxn];
vector<ll> gr1[maxn];
ll n, m;
ll cnt;
ll get(ll i,ll j)
{
return i*m+j;
}
void chk(ll k)
{
ll p=n*m-1;
ll len=n+m-1;
vector<ll> vtl;
vector<ll> vtr;
for (int i=0;i+k-1<=n+m-2;i++)
{
ll j=i+k-1;
vector<ll> vt;
vector<ll> vt1;
for (int t=i;t<=j;t++)
{
vt.pb(p+t+1);
vt1.pb(p+len+t+1);
}
add_or(vt);
cnt++;
add_xor(vt1);
cnt++;
add_not(cnt);
cnt++;
vector<ll> vtp;
vtp.pb(cnt);
vtp.pb(cnt-2);
add_and(vtp);
cnt++;
vtl.pb(cnt);
}
for (int i=0;i+k-1<=n+m-2;i++)
{
ll j=i+k-1;
vector<ll> vt,vt1;
for (int t=i;t<=j;t++)
{
vt.pb(p+2*len+t+1);
vt1.pb(p+3*len+t+1);
}
add_or(vt);
cnt++;
add_xor(vt1);
cnt++;
add_not(cnt);
cnt++;
vector<ll> vtp;
vtp.pb(cnt);
vtp.pb(cnt-2);
add_and(vtp);
cnt++;
vtr.pb(cnt);
}
add_or(vtl);
cnt++;
add_or(vtr);
cnt++;
vector<ll> res;
res.pb(cnt-1);
res.pb(cnt);
add_and(res);
cnt++;
}
void construct_network(int H, int W, int K)
{
n=H;
m=W;
ll k=K;
for(int i=0;i<n;i++)
{
for (int j=0;j<m;j++)
{
gr[i+j].pb(get(i,j));
gr1[i-j+m-1].pb(get(i,j));
}
}
cnt=n*m-1;
for (int i=0;i<=n+m-2;i++)
{
add_or(gr[i]);
}
for (int i=0;i<=n+m-2;i++)
{
add_xor(gr[i]);
}
for (int i=0;i<=n+m-2;i++)
{
add_or(gr1[i]);
}
for (int i=0;i<=n+m-2;i++)
{
add_xor(gr1[i]);
}
ll len=n+m-1;
cnt+=(4*len);
vector<ll> res;
chk(k+1);
res.pb(cnt);
chk(k);
add_not(cnt);
cnt++;
res.pb(cnt);
add_and(res);
}
/*int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if (fopen("t.inp","r"))
{
freopen("test.inp","r",stdin);
freopen("test.out","w",stdout);
}
}*/
Compilation message
vision.cpp: In function 'void chk(int)':
vision.cpp:46:9: error: 'add_or' was not declared in this scope
46 | add_or(vt);
| ^~~~~~
vision.cpp:48:9: error: 'add_xor' was not declared in this scope
48 | add_xor(vt1);
| ^~~~~~~
vision.cpp:50:9: error: 'add_not' was not declared in this scope
50 | add_not(cnt);
| ^~~~~~~
vision.cpp:55:9: error: 'add_and' was not declared in this scope
55 | add_and(vtp);
| ^~~~~~~
vision.cpp:68:10: error: 'add_or' was not declared in this scope
68 | add_or(vt);
| ^~~~~~
vision.cpp:70:9: error: 'add_xor' was not declared in this scope
70 | add_xor(vt1);
| ^~~~~~~
vision.cpp:72:9: error: 'add_not' was not declared in this scope
72 | add_not(cnt);
| ^~~~~~~
vision.cpp:77:9: error: 'add_and' was not declared in this scope
77 | add_and(vtp);
| ^~~~~~~
vision.cpp:81:5: error: 'add_or' was not declared in this scope
81 | add_or(vtl);
| ^~~~~~
vision.cpp:88:5: error: 'add_and' was not declared in this scope
88 | add_and(res);
| ^~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:107:9: error: 'add_or' was not declared in this scope
107 | add_or(gr[i]);
| ^~~~~~
vision.cpp:111:9: error: 'add_xor' was not declared in this scope
111 | add_xor(gr[i]);
| ^~~~~~~
vision.cpp:115:9: error: 'add_or' was not declared in this scope
115 | add_or(gr1[i]);
| ^~~~~~
vision.cpp:119:9: error: 'add_xor' was not declared in this scope
119 | add_xor(gr1[i]);
| ^~~~~~~
vision.cpp:127:5: error: 'add_not' was not declared in this scope
127 | add_not(cnt);
| ^~~~~~~
vision.cpp:130:5: error: 'add_and' was not declared in this scope
130 | add_and(res);
| ^~~~~~~