#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],nuli;
vector <pair <int, int> > X[1009],Y[1009];
vector <int> vv,v,va,vz,vx;
//
/*int add_xor(vector <int> q){
if(q.size()==0){
cout<<"ADDXOR";
exit(0);
}
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){
if(q.size()==0){
cout<<"ADDOR";
exit(0);
}
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){
if(q.size()==0){
cout<<"ADDAND";
exit(0);
}
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<420; 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));
}
if(vv.size()!=0) OR[i][j]=add_or(vv); else OR[i][j]=nuli;
if(vv.size()!=0) e=add_xor(vv); else e=nuli;
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,420); j++){
for(vector <pair <int, int> >::iterator it=X[j].begin(); it!=X[j].end(); it++){
vv.push_back(F((*it).first,(*it).second));
}
if(vv.size()!=0) OR[i][j]=add_or(vv); else OR[i][j]=nuli;
if(vv.size()!=0) e=add_xor(vv); else e=nuli;
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<420-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<420; 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));
}
if(vv.size()!=0) OR[i][j]=add_or(vv); else OR[i][j]=nuli;
if(vv.size()!=0) e=add_xor(vv); else e=nuli;
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,420); j++){
for(vector <pair <int, int> >::iterator it=Y[j].begin(); it!=Y[j].end(); it++){
vv.push_back(F((*it).first,(*it).second));
}
if(vv.size()!=0) OR[i][j]=add_or(vv); else OR[i][j]=nuli;
if(vv.size()!=0) e=add_xor(vv); else e=nuli;
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<420-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) {
if(H*W==2){
vv.clear();vv.push_back(0);vv.push_back(1);
nuli=add_xor(vv);
}else{
vv.clear();vv.push_back(0);vv.push_back(1);vv.push_back(2);
nuli=add_and(vv);
}
a=H;b=W;k=KK;
for(i=0; i<H; i++){
for(j=0; j<W; j++){
X[i+j].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:71:6: warning: unused variable 'QW' [-Wunused-variable]
71 | int QW=0,WE=0,ER=0,RT=0;
| ^~
vision.cpp:71:11: warning: unused variable 'WE' [-Wunused-variable]
71 | int QW=0,WE=0,ER=0,RT=0;
| ^~
vision.cpp:71:16: warning: unused variable 'ER' [-Wunused-variable]
71 | int QW=0,WE=0,ER=0,RT=0;
| ^~
vision.cpp:71:21: warning: unused variable 'RT' [-Wunused-variable]
71 | int QW=0,WE=0,ER=0,RT=0;
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3916 KB |
Output is correct |
2 |
Correct |
8 ms |
3048 KB |
Output is correct |
3 |
Correct |
5 ms |
4044 KB |
Output is correct |
4 |
Correct |
6 ms |
3016 KB |
Output is correct |
5 |
Correct |
4 ms |
3916 KB |
Output is correct |
6 |
Correct |
6 ms |
3024 KB |
Output is correct |
7 |
Correct |
4 ms |
3916 KB |
Output is correct |
8 |
Correct |
6 ms |
3016 KB |
Output is correct |
9 |
Correct |
6 ms |
2504 KB |
Output is correct |
10 |
Correct |
5 ms |
3916 KB |
Output is correct |
11 |
Correct |
6 ms |
3016 KB |
Output is correct |
12 |
Correct |
6 ms |
2608 KB |
Output is correct |
13 |
Correct |
4 ms |
3948 KB |
Output is correct |
14 |
Correct |
6 ms |
3016 KB |
Output is correct |
15 |
Correct |
6 ms |
2632 KB |
Output is correct |
16 |
Correct |
6 ms |
2248 KB |
Output is correct |
17 |
Correct |
5 ms |
3916 KB |
Output is correct |
18 |
Correct |
5 ms |
3916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3916 KB |
Output is correct |
2 |
Correct |
8 ms |
3048 KB |
Output is correct |
3 |
Correct |
5 ms |
4044 KB |
Output is correct |
4 |
Correct |
6 ms |
3016 KB |
Output is correct |
5 |
Correct |
4 ms |
3916 KB |
Output is correct |
6 |
Correct |
6 ms |
3024 KB |
Output is correct |
7 |
Correct |
4 ms |
3916 KB |
Output is correct |
8 |
Correct |
6 ms |
3016 KB |
Output is correct |
9 |
Correct |
6 ms |
2504 KB |
Output is correct |
10 |
Correct |
5 ms |
3916 KB |
Output is correct |
11 |
Correct |
6 ms |
3016 KB |
Output is correct |
12 |
Correct |
6 ms |
2608 KB |
Output is correct |
13 |
Correct |
4 ms |
3948 KB |
Output is correct |
14 |
Correct |
6 ms |
3016 KB |
Output is correct |
15 |
Correct |
6 ms |
2632 KB |
Output is correct |
16 |
Correct |
6 ms |
2248 KB |
Output is correct |
17 |
Correct |
5 ms |
3916 KB |
Output is correct |
18 |
Correct |
5 ms |
3916 KB |
Output is correct |
19 |
Correct |
8 ms |
2632 KB |
Output is correct |
20 |
Correct |
7 ms |
2248 KB |
Output is correct |
21 |
Correct |
7 ms |
3092 KB |
Output is correct |
22 |
Correct |
7 ms |
1608 KB |
Output is correct |
23 |
Correct |
5 ms |
3916 KB |
Output is correct |
24 |
Correct |
7 ms |
2248 KB |
Output is correct |
25 |
Correct |
7 ms |
1736 KB |
Output is correct |
26 |
Correct |
10 ms |
1608 KB |
Output is correct |
27 |
Correct |
8 ms |
1564 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3916 KB |
Output is correct |
2 |
Correct |
8 ms |
3048 KB |
Output is correct |
3 |
Correct |
5 ms |
4044 KB |
Output is correct |
4 |
Correct |
6 ms |
3016 KB |
Output is correct |
5 |
Correct |
4 ms |
3916 KB |
Output is correct |
6 |
Correct |
6 ms |
3024 KB |
Output is correct |
7 |
Correct |
4 ms |
3916 KB |
Output is correct |
8 |
Correct |
6 ms |
3016 KB |
Output is correct |
9 |
Correct |
6 ms |
2504 KB |
Output is correct |
10 |
Correct |
5 ms |
3916 KB |
Output is correct |
11 |
Correct |
6 ms |
3016 KB |
Output is correct |
12 |
Correct |
6 ms |
2608 KB |
Output is correct |
13 |
Correct |
4 ms |
3948 KB |
Output is correct |
14 |
Correct |
6 ms |
3016 KB |
Output is correct |
15 |
Correct |
6 ms |
2632 KB |
Output is correct |
16 |
Correct |
6 ms |
2248 KB |
Output is correct |
17 |
Correct |
5 ms |
3916 KB |
Output is correct |
18 |
Correct |
5 ms |
3916 KB |
Output is correct |
19 |
Correct |
8 ms |
2632 KB |
Output is correct |
20 |
Correct |
7 ms |
2248 KB |
Output is correct |
21 |
Correct |
7 ms |
3092 KB |
Output is correct |
22 |
Correct |
7 ms |
1608 KB |
Output is correct |
23 |
Correct |
5 ms |
3916 KB |
Output is correct |
24 |
Correct |
7 ms |
2248 KB |
Output is correct |
25 |
Correct |
7 ms |
1736 KB |
Output is correct |
26 |
Correct |
10 ms |
1608 KB |
Output is correct |
27 |
Correct |
8 ms |
1564 KB |
Output is correct |
28 |
Incorrect |
3 ms |
1992 KB |
WA in grader: Too many instructions |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3916 KB |
Output is correct |
2 |
Correct |
8 ms |
3048 KB |
Output is correct |
3 |
Correct |
5 ms |
4044 KB |
Output is correct |
4 |
Correct |
6 ms |
3016 KB |
Output is correct |
5 |
Correct |
4 ms |
3916 KB |
Output is correct |
6 |
Correct |
6 ms |
3024 KB |
Output is correct |
7 |
Correct |
4 ms |
3916 KB |
Output is correct |
8 |
Correct |
6 ms |
3016 KB |
Output is correct |
9 |
Correct |
6 ms |
2504 KB |
Output is correct |
10 |
Correct |
5 ms |
3916 KB |
Output is correct |
11 |
Correct |
6 ms |
3016 KB |
Output is correct |
12 |
Correct |
6 ms |
2608 KB |
Output is correct |
13 |
Correct |
4 ms |
3948 KB |
Output is correct |
14 |
Correct |
6 ms |
3016 KB |
Output is correct |
15 |
Correct |
6 ms |
2632 KB |
Output is correct |
16 |
Correct |
6 ms |
2248 KB |
Output is correct |
17 |
Correct |
5 ms |
3916 KB |
Output is correct |
18 |
Correct |
5 ms |
3916 KB |
Output is correct |
19 |
Correct |
8 ms |
2632 KB |
Output is correct |
20 |
Correct |
7 ms |
2248 KB |
Output is correct |
21 |
Correct |
7 ms |
3092 KB |
Output is correct |
22 |
Correct |
7 ms |
1608 KB |
Output is correct |
23 |
Correct |
5 ms |
3916 KB |
Output is correct |
24 |
Correct |
7 ms |
2248 KB |
Output is correct |
25 |
Correct |
7 ms |
1736 KB |
Output is correct |
26 |
Correct |
10 ms |
1608 KB |
Output is correct |
27 |
Correct |
8 ms |
1564 KB |
Output is correct |
28 |
Incorrect |
3 ms |
1992 KB |
WA in grader: Too many instructions |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
4044 KB |
Output is correct |
2 |
Incorrect |
2 ms |
1484 KB |
WA in grader: Too many instructions |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
3916 KB |
Output is correct |
2 |
Correct |
7 ms |
3016 KB |
Output is correct |
3 |
Correct |
9 ms |
4424 KB |
Output is correct |
4 |
Incorrect |
5 ms |
4040 KB |
WA in grader: Too many instructions |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
9704 KB |
Output is correct |
2 |
Correct |
5 ms |
3932 KB |
Output is correct |
3 |
Correct |
9 ms |
4312 KB |
Output is correct |
4 |
Correct |
14 ms |
4840 KB |
Output is correct |
5 |
Correct |
6 ms |
4108 KB |
Output is correct |
6 |
Correct |
5 ms |
4044 KB |
Output is correct |
7 |
Correct |
33 ms |
6812 KB |
Output is correct |
8 |
Correct |
33 ms |
6756 KB |
Output is correct |
9 |
Correct |
62 ms |
9792 KB |
Output is correct |
10 |
Correct |
4 ms |
3916 KB |
Output is correct |
11 |
Correct |
5 ms |
3916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3916 KB |
Output is correct |
2 |
Correct |
8 ms |
3048 KB |
Output is correct |
3 |
Correct |
5 ms |
4044 KB |
Output is correct |
4 |
Correct |
6 ms |
3016 KB |
Output is correct |
5 |
Correct |
4 ms |
3916 KB |
Output is correct |
6 |
Correct |
6 ms |
3024 KB |
Output is correct |
7 |
Correct |
4 ms |
3916 KB |
Output is correct |
8 |
Correct |
6 ms |
3016 KB |
Output is correct |
9 |
Correct |
6 ms |
2504 KB |
Output is correct |
10 |
Correct |
5 ms |
3916 KB |
Output is correct |
11 |
Correct |
6 ms |
3016 KB |
Output is correct |
12 |
Correct |
6 ms |
2608 KB |
Output is correct |
13 |
Correct |
4 ms |
3948 KB |
Output is correct |
14 |
Correct |
6 ms |
3016 KB |
Output is correct |
15 |
Correct |
6 ms |
2632 KB |
Output is correct |
16 |
Correct |
6 ms |
2248 KB |
Output is correct |
17 |
Correct |
5 ms |
3916 KB |
Output is correct |
18 |
Correct |
5 ms |
3916 KB |
Output is correct |
19 |
Correct |
8 ms |
2632 KB |
Output is correct |
20 |
Correct |
7 ms |
2248 KB |
Output is correct |
21 |
Correct |
7 ms |
3092 KB |
Output is correct |
22 |
Correct |
7 ms |
1608 KB |
Output is correct |
23 |
Correct |
5 ms |
3916 KB |
Output is correct |
24 |
Correct |
7 ms |
2248 KB |
Output is correct |
25 |
Correct |
7 ms |
1736 KB |
Output is correct |
26 |
Correct |
10 ms |
1608 KB |
Output is correct |
27 |
Correct |
8 ms |
1564 KB |
Output is correct |
28 |
Incorrect |
3 ms |
1992 KB |
WA in grader: Too many instructions |
29 |
Halted |
0 ms |
0 KB |
- |