#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void solvefor1(int H,int W,int K){
int cnt = 0;
for(int i=0;i<H;i++)
for(int j=0;j<W;j++)
if(i+j==K){
vector<int>vec;
vec.push_back(0);
vec.push_back(i*W+j);
add_and(vec);
cnt++;
}
vector<int>vec;
for(int i=H*W;i<H*W+cnt;i++)
vec.push_back(i);
add_or(vec);
}
void construct_network(int H, int W, int K) {
if(H==1||W==1){
solvefor1(H,W,K);
return ;
}
int cnt = W*H;
for(int i=0;i<H;i++){
vector<int>vec;
for(int j=0;j<W;j++)
vec.push_back(i*W+j);
add_or(vec);
cnt++;
}
for(int i=0;i<H-1;i++){
vector<int>vec;
vec.push_back(H*W+i);
vec.push_back(H*W+i+1);
add_and(vec);
cnt++;
}
vector<int>vec1;
for(int i=0;i<H-1;i++)
vec1.push_back(H*W+H+i);
add_or(vec1);cnt++;
vec1.clear();
for(int i=0;i<W;i++){
vector<int>vec;
for(int j=0;j<H;j++)
vec.push_back(j*W+i);
add_or(vec);
cnt++;
}
for(int i=0;i<W-1;i++){
vector<int>vec;
vec.push_back(H*W+H*2+i);
vec.push_back(H*W+H*2+i+1);
add_and(vec);
cnt++;
}
for(int i=0;i<W-1;i++)
vec1.push_back(H*W+H*2+W+i);
add_or(vec1);cnt++;
vec1.clear();
for(int i=0;i<H;i++)
vec1.push_back(H*W+i);
add_xor(vec1);
vec1.clear();
for(int i=0;i<W;i++)
vec1.push_back(H*W+H*2+i);
add_xor(vec1);vec1.clear();
vec1.push_back(H*W+2*H+2*W);
vec1.push_back(H*W+2*H+W+W-1);
add_and(vec1);
vec1.clear();
vec1.push_back(H*W+2*H+2*W+1);
vec1.push_back(H*W+2*H-1);
add_and(vec1);
vec1.clear();
vec1.push_back(H*W+2*H+2*W+2);
vec1.push_back(H*W+2*H+2*W+3);
add_or(vec1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
204 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 |
10 ms |
1092 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
5 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |