This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
}
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |