#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void construct_network(int h, int w, int k)
{
vector<int> rd1(w + h - 1);
vector<int> rd2(w + h - 1);
vector<int> ld1(w + h - 1);
vector<int> ld2(w + h - 1);
for (int d = 0; d < w + h - 1; d++)
{
vector<int> idxR, idxL;
// i + j = d
for (int i = 0, j = d; i < h && j >= 0; i++, j--)
if (j < w) idxR.push_back(i * w + j);
// i + (w - 1 - j) = d
for (int i = 0, j = w - d - 1; i < h && j < w; i++, j++)
if (j >= 0) idxL.push_back(i * w + j);
rd1[d] = add_or(idxR);
rd2[d] = add_and({rd1[d], add_not(add_xor(idxR))});
ld1[d] = add_or(idxL);
ld2[d] = add_and({ld1[d], add_not(add_xor(idxL))});
}
vector<int> A, B;
for (int d = 0; d + k < w + h - 1; d++)
{
vector<int> idxR1, idxR2, idxL1, idxL2;
for (int i = d; i <= d + k; i++)
{
idxR1.push_back(rd1[d]);
idxR2.push_back(rd2[d]);
idxL1.push_back(ld1[d]);
idxL2.push_back(ld2[d]);
}
int r1 = add_xor(idxR1);
int r2 = add_or(idxR1);
int r3 = add_or(idxR2);
int l1 = add_xor(idxL1);
int l2 = add_or(idxL1);
int l3 = add_or(idxL2);
A.push_back(add_or({r3, add_and({r2, add_not(r1)})}));
B.push_back(add_or({l3, add_and({l2, add_not(l1)})}));
}
vector<int> C, D;
for (int d = 0; d + k - 1 < w + h - 1; d++)
{
vector<int> idxR1, idxR2, idxL1, idxL2;
for (int i = d; i <= d + k - 1; i++)
{
idxR1.push_back(rd1[d]);
idxR2.push_back(rd2[d]);
idxL1.push_back(ld1[d]);
idxL2.push_back(ld2[d]);
}
int r1 = add_xor(idxR1);
int r2 = add_or(idxR1);
int r3 = add_or(idxR2);
int l1 = add_xor(idxL1);
int l2 = add_or(idxL1);
int l3 = add_or(idxL2);
C.push_back(add_or({r3, add_and({r2, add_not(r1)})}));
D.push_back(add_or({l3, add_and({l2, add_not(l1)})}));
}
int x = add_and({add_or(A), add_or(B)});
int y = add_and({add_or(A), add_or(B)});
add_and({x, add_not(y)});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
720 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1616 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |