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>
#include "vision.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,K,prX[409],sfX[409],prY[409],sfY[409],nag;
vector <int> X[409],Y[409],V,vv,Z,x,y;
int ID(int q, int w){
return q*b+w;
}
void construct_network(int HH, int WW, int KK) {
c=add_not(0);d=add_not(c);
vv.clear();vv.push_back(c);vv.push_back(d);
nag=add_and(vv);
a=HH;b=WW;K=KK;
for(i=0; i<=402; i++){
X[i].clear();Y[i].clear();V.clear();vv.clear();
prX[i]=sfX[i]=nag;prY[i]=sfY[i]=nag;
}
for(i=0; i<a; i++){
for(j=0; j<b; j++){
ii=i+j;jj=i-j+b;
X[ii].push_back(ID(i,j));
Y[jj].push_back(ID(i,j));
}
}
for(i=0; i<=400; i++){
j=i+K;if(j>400) break;
if(X[i].size()==0||X[j].size()==0) continue;
c=add_or(X[i]);d=add_or(X[j]);
vv.clear();vv.push_back(c);vv.push_back(d);
e=add_and(vv);
V.push_back(e);
}
for(i=0; i<=400; i++){
j=i+K;if(j>400) break;
if(Y[i].size()==0||Y[j].size()==0) continue;
c=add_or(Y[i]);d=add_or(Y[j]);
vv.clear();vv.push_back(c);vv.push_back(d);
e=add_and(vv);
V.push_back(e);
}
if(V.size()==0) return;
//
for(i=0; i<=400; i++){
x.clear();
for(jj=0; jj<X[i].size(); jj++){
x.push_back(X[i][jj]);
}
if(x.size()==0){
if(i!=0) prX[i]=prX[i-1];
}else{
e=add_or(x);
if(i!=0){
vv.clear();vv.push_back(e);vv.push_back(prX[i-1]);
prX[i]=add_or(vv);
}else{
prX[i]=e;
}
}
x.clear();
for(jj=0; jj<Y[i].size(); jj++){
x.push_back(Y[i][jj]);
}
if(x.size()==0){
if(i!=0) prY[i]=prY[i-1];
}else{
e=add_or(x);
if(i!=0){
vv.clear();vv.push_back(e);vv.push_back(prY[i-1]);
prY[i]=add_or(vv);
}else{
prY[i]=e;
}
}
}
for(i=400; i>=0; i--){
x.clear();
for(jj=0; jj<X[i].size(); jj++){
x.push_back(X[i][jj]);
}
if(x.size()==0){
if(i!=400) sfX[i]=sfX[i+1];
}else{
e=add_or(x);
if(i!=400){
vv.clear();vv.push_back(e);vv.push_back(sfX[i+1]);
sfX[i]=add_or(vv);
}else{
sfX[i]=e;
}
}
x.clear();
for(jj=0; jj<Y[i].size(); jj++){
x.push_back(Y[i][jj]);
}
if(x.size()==0){
if(i!=400) sfY[i]=sfY[i+1];
}else{
e=add_or(x);
if(i!=400){
vv.clear();vv.push_back(e);vv.push_back(sfY[i+1]);
sfY[i]=add_or(vv);
}else{
sfY[i]=e;
}
}
}
//
for(i=0; i<=400; i++){
j=i+K+1;if(j>400) break;
/*x.clear();y.clear();
for(ii=0; ii<=i; ii++){
for(jj=0; jj<X[ii].size(); jj++){
x.push_back(X[ii][jj]);
}
}
for(ii=j; ii<=400; ii++){
for(jj=0; jj<X[ii].size(); jj++){
y.push_back(X[ii][jj]);
}
}
if(x.size()==0||y.size()==0) continue;
c=add_or(x);d=add_or(y);*/
c=prX[i];d=sfX[j];
vv.clear();vv.push_back(c);vv.push_back(d);
e=add_and(vv);e=add_not(e);
Z.push_back(e);
}
for(i=0; i<=400; i++){
j=i+K+1;if(j>400) break;
/*x.clear();y.clear();
for(ii=0; ii<=i; ii++){
for(jj=0; jj<Y[ii].size(); jj++){
x.push_back(Y[ii][jj]);
}
}
for(ii=j; ii<=400; ii++){
for(jj=0; jj<Y[ii].size(); jj++){
y.push_back(Y[ii][jj]);
}
}
if(x.size()==0||y.size()==0) continue;
c=add_or(x);d=add_or(y);*/
c=prY[i];d=sfY[j];
vv.clear();vv.push_back(c);vv.push_back(d);
e=add_and(vv);e=add_not(e);
Z.push_back(e);
}
if(Z.size()!=0){
c=add_and(Z);d=add_or(V);
vv.clear();vv.push_back(c);vv.push_back(d);
add_and(vv);
}else{
add_or(V);
}
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:45:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | for(jj=0; jj<X[i].size(); jj++){
| ~~^~~~~~~~~~~~
vision.cpp:61:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
61 | for(jj=0; jj<Y[i].size(); jj++){
| ~~^~~~~~~~~~~~
vision.cpp:78:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
78 | for(jj=0; jj<X[i].size(); jj++){
| ~~^~~~~~~~~~~~
vision.cpp:94:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
94 | for(jj=0; jj<Y[i].size(); jj++){
| ~~^~~~~~~~~~~~
# | 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... |