#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);
}
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
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 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
2 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
2 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
324 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
2 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
324 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
9 ms |
824 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
2 ms |
316 KB |
Output is correct |
32 |
Correct |
6 ms |
596 KB |
Output is correct |
33 |
Correct |
13 ms |
1180 KB |
Output is correct |
34 |
Correct |
9 ms |
828 KB |
Output is correct |
35 |
Correct |
6 ms |
412 KB |
Output is correct |
36 |
Correct |
4 ms |
356 KB |
Output is correct |
37 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
2 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
324 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
9 ms |
824 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
2 ms |
316 KB |
Output is correct |
32 |
Correct |
6 ms |
596 KB |
Output is correct |
33 |
Correct |
13 ms |
1180 KB |
Output is correct |
34 |
Correct |
9 ms |
828 KB |
Output is correct |
35 |
Correct |
6 ms |
412 KB |
Output is correct |
36 |
Correct |
4 ms |
356 KB |
Output is correct |
37 |
Correct |
3 ms |
340 KB |
Output is correct |
38 |
Incorrect |
9 ms |
5716 KB |
WA in grader: Too many inputs |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 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 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
12 ms |
1108 KB |
Output is correct |
6 |
Correct |
6 ms |
656 KB |
Output is correct |
7 |
Correct |
2 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
316 KB |
Output is correct |
9 |
Correct |
9 ms |
1096 KB |
Output is correct |
10 |
Correct |
6 ms |
832 KB |
Output is correct |
11 |
Correct |
3 ms |
468 KB |
Output is correct |
12 |
Correct |
3 ms |
572 KB |
Output is correct |
13 |
Correct |
2 ms |
320 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
10 ms |
1108 KB |
Output is correct |
16 |
Correct |
6 ms |
852 KB |
Output is correct |
17 |
Correct |
3 ms |
596 KB |
Output is correct |
18 |
Correct |
5 ms |
468 KB |
Output is correct |
19 |
Correct |
2 ms |
320 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
80 ms |
7256 KB |
Output is correct |
4 |
Correct |
48 ms |
4240 KB |
Output is correct |
5 |
Correct |
21 ms |
1832 KB |
Output is correct |
6 |
Correct |
9 ms |
608 KB |
Output is correct |
7 |
Correct |
5 ms |
340 KB |
Output is correct |
8 |
Incorrect |
7 ms |
5440 KB |
WA in grader: Too many inputs |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 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 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
2 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
320 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
2 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
324 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
9 ms |
824 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
2 ms |
316 KB |
Output is correct |
32 |
Correct |
6 ms |
596 KB |
Output is correct |
33 |
Correct |
13 ms |
1180 KB |
Output is correct |
34 |
Correct |
9 ms |
828 KB |
Output is correct |
35 |
Correct |
6 ms |
412 KB |
Output is correct |
36 |
Correct |
4 ms |
356 KB |
Output is correct |
37 |
Correct |
3 ms |
340 KB |
Output is correct |
38 |
Incorrect |
9 ms |
5716 KB |
WA in grader: Too many inputs |
39 |
Halted |
0 ms |
0 KB |
- |