#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K){
vector<int>id,id1;
for(int i=0;i<H-K-1;i++){
vector<int>v,u;
for(int j=0;j<=i;j++){
for(int k=0;k<W;k++){
v.push_back(j*W+k);
}
}
for(int j=i+K+1;j<H;j++){
for(int k=0;k<W;k++){
u.push_back(j*W+k);
}
}
int a=add_or(v);
int b=add_or(u);
id.push_back(add_and({a,b}));
}
for(int i=0;i<W-K-1;i++){
vector<int>v,u;
for(int j=0;j<H;j++){
for(int k=0;k<=i;k++){
v.push_back(j*W+k);
}
}
for(int j=0;j<H;j++){
for(int k=i+K+1;k<W;k++){
u.push_back(j*W+k);
}
}
int a=add_or(v);
int b=add_or(u);
id.push_back(add_and({a,b}));
}
for(int i=0;i<K;i++){
for(int j=i;j<=(H+W-2-K);j+=K){
vector<int>v,u;
for(int k=j;k>=0;k--){
if(k<H && (j-k)<W){
v.push_back(k*W+j-k);
}
}
for(int k=j+K;k>=0;k--){
if(k<H && (j-k)<W){
u.push_back(k*W+j-k);
}
}
int a,b;
if(u.size()) a=add_or(u);
else continue;
if(v.size()) b=add_or(v);
else continue;
id1.push_back(add_and({a,b}));
}
}
for(int i=0;i<K;i++){
for(int j=i;j<=(H+W-2-K);j+=K){
vector<int>v,u;
for(int k=j;k>=0;k--){
if(k<H && (W-j+k)>=0){
v.push_back(k*W+W-j+k);
}
}
for(int k=j+K;k>=0;k--){
if(k<H && (W-j+k)>=0){
u.push_back(k*W+W-j+k);
}
}
int a,b;
if(u.size()) a=add_or(u);
else continue;
if(v.size()) b=add_or(v);
else continue;
id1.push_back(add_and({a,b}));
}
}
vector<int>y;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
y.push_back(i*W+j);
}
}
int r=add_xor(y);
int a,b;
if(id.size()!=0){
a=add_or(id);
a=add_not(a);
if(id1.size()!=0){
int b=add_or(id1);
add_and({a,b});
}
else{
add_or({r});
}
}
else{
if(id1.size()!=0){
int b=add_or(id1);
}
else add_or({r});
}
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:101:8: warning: unused variable 'b' [-Wunused-variable]
101 | int b=add_or(id1);
| ^
vision.cpp:87:8: warning: unused variable 'b' [-Wunused-variable]
87 | int a,b;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
792 KB |
Output is correct |
2 |
Incorrect |
3 ms |
332 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
4752 KB |
WA in grader: Too many inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |