#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
const int N=200;
int a,b,c,d,e,i,j,ii,jj,zx,xc,k,OR[1009][1009],TWO[1009][1009],K,COUNTI,MASIVI[1000009];
vector <pair <int, int> > X[1009],Y[1009];
vector <int> vv,v,va,vz,vx;
//
/*int add_xor(vector <int> q){
int qw=0;
for(int qq=0; qq<q.size(); qq++){
qw^=MASIVI[q[qq]];
}
COUNTI++;MASIVI[COUNTI]=qw;
return COUNTI;
}
int add_or(vector <int> q){
int qw=0;
for(int qq=0; qq<q.size(); qq++){
qw|=MASIVI[q[qq]];
}
COUNTI++;MASIVI[COUNTI]=qw;
return COUNTI;
}
int add_and(vector <int> q){
int qw=1;
for(int qq=0; qq<q.size(); qq++){
qw&=MASIVI[q[qq]];
}
COUNTI++;MASIVI[COUNTI]=qw;
return COUNTI;
}
int add_not(int q){
int qq=0;
if(MASIVI[q]==0) qq=1; else qq=0;
COUNTI++;MASIVI[COUNTI]=qq;
return COUNTI;
}*/
//
int TWONUMBER(vector <int> q){
int qw=0,we=0;
vector <int> QW,WE;
//QW.push_back(q);QW.push_back(w);
qw=add_or(q);we=add_xor(q);
WE.push_back(qw);WE.push_back(we);
return add_xor(WE);
}
int F(int q, int w){
return q*b+w;
}
int READ(int q, int w){
if(w%K==K-1){
return TWO[w][q];
}
if(q%K==0){
return TWO[q-1][w];
}
int qw=w/K;qw*=K;qw--;
int QW=0,WE=0,ER=0,RT=0;
vz.clear();vz.push_back(TWO[qw][q]);vz.push_back(TWO[qw][w]);
vx.clear();vx.push_back(OR[qw][q]);vx.push_back(OR[qw][w]);
vz.push_back(TWONUMBER(vx));
return add_or(vz);
}
int solve(int KK){
K=KK;
int QW=0,WE=0;
//X
for(i=K-1; i<1000; i+=K){
vv.clear();
for(j=i; j>i-K; j--){
for(vector <pair <int, int> >::iterator it=X[j].begin(); it!=X[j].end(); it++){
vv.push_back(F((*it).first,(*it).second));
}
OR[i][j]=add_or(vv);
e=add_xor(vv);
v.clear();v.push_back(OR[i][j]);v.push_back(e);
TWO[i][j]=add_xor(v);
}
vv.clear();
for(j=i+1; j<min(i+K,1001); j++){
for(vector <pair <int, int> >::iterator it=X[j].begin(); it!=X[j].end(); it++){
vv.push_back(F((*it).first,(*it).second));
}
OR[i][j]=add_or(vv);
e=add_xor(vv);
v.clear();v.push_back(OR[i][j]);v.push_back(e);
TWO[i][j]=add_xor(v);
}
}
//exit(0);
//cout<<MASIVI[READ(0,2)]<<" "<<K;
//exit(0);
va.clear();
for(i=0; i<1000-K-1; i++){
int ee=READ(i,i+K-1);
//cout<<MASIVI[ee]<<endl;
va.push_back(ee);
}
QW=add_or(va);
//exit(0);
//Y
for(i=K-1; i<1000; i+=K){
vv.clear();
for(j=i; j>i-K; j--){
for(vector <pair <int, int> >::iterator it=Y[j].begin(); it!=Y[j].end(); it++){
vv.push_back(F((*it).first,(*it).second));
}
OR[i][j]=add_or(vv);
e=add_xor(vv);
v.clear();v.push_back(OR[i][j]);v.push_back(e);
TWO[i][j]=add_xor(v);
}
vv.clear();
//for(j=i+1; j<1000; j++){
for(j=i+1; j<min(i+K,1001); j++){
for(vector <pair <int, int> >::iterator it=Y[j].begin(); it!=Y[j].end(); it++){
vv.push_back(F((*it).first,(*it).second));
}
OR[i][j]=add_or(vv);
e=add_xor(vv);
v.clear();v.push_back(OR[i][j]);v.push_back(e);
TWO[i][j]=add_xor(v);
}
}
//exit(0);
va.clear();
for(i=0; i<1000-K-1; i++){
va.push_back(READ(i,i+K-1));
//if(i>=5) exit(0);
}
WE=add_or(va);
//exit(0);
//cout<<MASIVI[QW]<<" "<<MASIVI[WE]<<" "<<K<<endl;
va.clear();va.push_back(QW);va.push_back(WE);
return add_and(va);
}
void construct_network(int H, int W, int KK) {
a=H;b=W;k=KK;
for(i=0; i<H; i++){
for(j=0; j<W; j++){
X[i+j+N].push_back(make_pair(i,j));
Y[i-j+N].push_back(make_pair(i,j));
}
}
int AX=solve(k);
int AZ=solve(k+1);
//cout<<MASIVI[AX]<<" "<<MASIVI[AZ]<<endl;
vv.clear();vv.push_back(AZ);vv.push_back(AX);
add_xor(vv);
}
/*int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>b>>k;
cin>>c>>d>>zx>>xc;
MASIVI[F(c,d)]=1;
MASIVI[F(zx,xc)]=1;
COUNTI=F(a-1,b-1);
c=0;d=0;zx=0;xc=0;
construct_network(a,b,k);
cout<<MASIVI[COUNTI];
return 0;
}*/
Compilation message
vision.cpp: In function 'int READ(int, int)':
vision.cpp:59:6: warning: unused variable 'QW' [-Wunused-variable]
59 | int QW=0,WE=0,ER=0,RT=0;
| ^~
vision.cpp:59:11: warning: unused variable 'WE' [-Wunused-variable]
59 | int QW=0,WE=0,ER=0,RT=0;
| ^~
vision.cpp:59:16: warning: unused variable 'ER' [-Wunused-variable]
59 | int QW=0,WE=0,ER=0,RT=0;
| ^~
vision.cpp:59:21: warning: unused variable 'RT' [-Wunused-variable]
59 | int QW=0,WE=0,ER=0,RT=0;
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1228 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |