#include <iostream>
#include "vision.h"
#define pb push_back
using namespace std;
int w;
const int N=405;
int d1[N],d2[N],xor1[N],xor2[N],dub1[N],dub2[N];
inline int c(int i, int j){return i*w+j;}
void construct_network(int H, int W, int K){
w=W;
int dsk=H+W-1;
for(int s=0; s<dsk; s++){
vector<int> sk1,sk2;
for(int i=0; i<=s; i++){
int j=s-i;
if(i<H && j<W && i>=0 && j>=0) sk1.pb(c(i,j));
int i2=H-i-1;
if(i2<H && j<W && i2>=0 && j>=0) sk2.pb(c(i2,j));
}
if(sk1.size()>0) d1[s]=add_or(sk1);
if(sk2.size()>0) d2[s]=add_or(sk2);
dub1[s]=add_and({d1[s],add_not(add_xor(sk1))});
dub2[s]=add_and({d2[s],add_not(add_xor(sk2))});
}
for(int i=0; i<dsk; i++){
cout<<d1[i]<<' ';
}
cout<<'\n';
for(int i=0; i<dsk; i++){
cout<<d2[i]<<' ';
}
cout<<'\n';
vector<int> sk1,sk2;
for(int i=0; i+K<=dsk; i++){
vector<int> orsk1,orsk2;
for(int j=i; j<i+K; j++) orsk1.pb(d1[j]);
for(int j=i; j<i+K; j++) orsk2.pb(d2[j]);
sk1.pb(add_and({add_or(orsk1),add_not(add_xor(orsk1))}));
sk2.pb(add_and({add_or(orsk2),add_not(add_xor(orsk2))}));
}
vector<int> vd1,vd2;
for(int i=0; i<dsk; i++){
vd1.pb(dub1[i]);
vd2.pb(dub2[i]);
}
sk1.pb(add_or(vd1));
sk2.pb(add_or(vd2));
int temp1=add_or(sk1),temp2=add_or(sk2);
int atb1=add_and({temp1,temp2});
K++;
sk1.clear();
sk2.clear();
vd1.clear();
vd2.clear();
for(int i=0; i+K<=dsk; i++){
vector<int> orsk1,orsk2;
for(int j=i; j<i+K; j++) orsk1.pb(d1[j]);
for(int j=i; j<i+K; j++) orsk2.pb(d2[j]);
sk1.pb(add_and({add_or(orsk1),add_not(add_xor(orsk1))}));
sk2.pb(add_and({add_or(orsk2),add_not(add_xor(orsk2))}));
}
for(int i=0; i<dsk; i++){
vd1.pb(dub1[i]);
vd2.pb(dub2[i]);
}
sk1.pb(add_or(vd1));
sk2.pb(add_or(vd2));
temp1=add_or(sk1),temp2=add_or(sk2);
int atb2=add_and({temp1,temp2});
add_and({add_not(atb1),atb2});
return;
}
# | 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... |