#include "vision.h"
#include <vector>
using namespace std;
void construct_network(int H, int W, int K) {
for(int i = 0; i < H; ++i) {
vector<int> elems;
for(int j = 0; j < W; ++j) {
elems.push_back(i * W + j);
}
add_xor(elems);
}
for(int i = 0; i < W; ++i) {
vector<int> elems;
for(int j = 0; j < H; ++j) {
elems.push_back(j * W + i);
}
add_xor(elems);
}
vector<int> ax, ay;
for(int i = 0; i < H; ++i) {
for(int j = i + 1; j < H; ++j) {
add_and({H * W + i, H * W + j});
ax.push_back(j - i);
}
}
for(int i = 0; i < W; ++i) {
for(int j = i + 1; j < W; ++j) {
add_and({H * W + H + i, H * W + H + j});
ay.push_back(j - i);
}
}
int qs = H * W + H + W + H * (H - 1) / 2 + W * (W - 1) / 2;
for(int i = 0; i < H; ++i) {
if(i == 0) {
vector<int> elems;
for(int j = 0; j < int(ax.size()); ++j) {
elems.push_back(H * W + H + W + j);
}
add_or(elems);
add_not(qs);
}
else {
vector<int> elems;
for(int j = 0; j < int(ax.size()); ++j) {
if(ax[j] == i) {
elems.push_back(H * W + H + W + j);
}
}
add_or(elems);
}
}
for(int i = 0; i < W; ++i) {
if(i == 0) {
vector<int> elems;
for(int j = 0; j < int(ay.size()); ++j) {
elems.push_back(H * W + H + W + H * (H - 1) / 2 + j);
}
add_or(elems);
add_not(qs + (H + 1));
}
else {
vector<int> elems;
for(int j = 0; j < int(ay.size()); ++j) {
if(ay[j] == i) {
elems.push_back(H * W + H + W + H * (H - 1) / 2 + j);
}
}
add_or(elems);
}
}
int cnt = 0;
for(int i = 0; i < H; ++i) {
for(int j = 0; j < W; ++j) {
if(i + j == K) {
add_and({qs + i + 1, qs + (H + 1) + j + 1});
++cnt;
}
}
}
vector<int> felems;
for(int i = 0; i < cnt; ++i) {
felems.push_back(qs + (H + 1) + (W + 1) + i);
}
add_or(felems);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1148 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
1020 KB |
Output is correct |
4 |
Correct |
6 ms |
1020 KB |
Output is correct |
5 |
Correct |
6 ms |
892 KB |
Output is correct |
6 |
Correct |
6 ms |
892 KB |
Output is correct |
7 |
Correct |
6 ms |
892 KB |
Output is correct |
8 |
Incorrect |
2 ms |
1148 KB |
WA in grader: Too many instructions |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1404 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |