#include <bits/stdc++.h>
using namespace std;
#include "vision.h"
int h, w, c0, c1, d;
int pti(int i, int j) {
return w * i + j;
}
vector<int> md (int i, int d, int D) {
/* 0 - / 1 - \ */
vector<int> v;
v.push_back(D);
if(i < 0)
return v;
int j;
if (d) {
j = h - 1;
if(i >= w) {
j -= i - w + 1;
i = w - 1;
}
} else {
j = 0;
if(i >= w) {
j += i - w + 1;
i = w - 1;
}
}
while (i >= 0 && j >= 0 && j < h) {
v.push_back (pti(i, j));
if (d) --j;
else ++j;
--i;
}
return v;
}
int amatmata (int k) {
vector<int> v;
d = add_or({c0});
for(int i = 0; i < w + h - 1; ++i) {
d = add_or (md (i - k, 0, d));
v.push_back (add_and ({add_or (md (i, 0, c0) ), d}) );
}
d = add_or({c0});
for(int i = 0; i < w + h - 1; ++i) {
d = add_or(md (i - k, 1, d));
v.push_back(add_and ({add_or (md (i, 1, c0) ), d}) );
}
return add_or(v);
}
void construct_network (int H, int W, int K) {
if (H * W == 2) {
add_or ({0});
return;
}
c0 = add_and ({0, 1, 2});
c1 = add_not (c0);
h = H;
w = W;
add_and({amatmata (K), add_not (amatmata (K + 1))});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
256 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 |
8 ms |
256 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 |
8 ms |
256 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 |
8 ms |
256 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 |
256 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
5 ms |
632 KB |
on inputs (0, 0), (1, 0), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
3780 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Incorrect |
6 ms |
632 KB |
on inputs (96, 18), (96, 19), expected 1, but computed 0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |