#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,K;
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) {
a=HH;b=WW;K=KK;
for(i=0; i<=402; i++){
X[i].clear();Y[i].clear();V.clear();vv.clear();
}
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;
//if(V.size()!=0) add_or(V);
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);
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);
vv.clear();vv.push_back(c);vv.push_back(d);
e=add_and(vv);e=add_not(e);
Z.push_back(e);
}
c=add_and(Z);d=add_or(V);
vv.clear();vv.push_back(c);vv.push_back(d);
add_and(vv);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:43:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(jj=0; jj<X[ii].size(); jj++){
| ~~^~~~~~~~~~~~~
vision.cpp:48:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
48 | for(jj=0; jj<X[ii].size(); jj++){
| ~~^~~~~~~~~~~~~
vision.cpp:62:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
62 | for(jj=0; jj<Y[ii].size(); jj++){
| ~~^~~~~~~~~~~~~
vision.cpp:67:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
67 | for(jj=0; jj<Y[ii].size(); jj++){
| ~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
1108 KB |
Output is correct |
2 |
Correct |
4 ms |
468 KB |
Output is correct |
3 |
Correct |
3 ms |
468 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
5168 KB |
WA in grader: Too many inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |