#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int h, w;
int idx(int i, int j) {
return i * w + j;
}
int add_diagonals(int k) {
map<int, vector<int> > diag1, diag2;
map<int, int> rep1, rep2;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
diag1[i - j].push_back(idx(i, j));
diag2[i + j].push_back(idx(i, j));
}
}
for (auto &p : diag1) rep1[p.first] = add_or(p.second);
for (auto &p : diag2) rep2[p.first] = add_or(p.second);
vector<int> e1, e2;
for (auto &p : rep1) {
if (!rep1.count(p.first + k)) continue;
e1.push_back(add_and({p.second, rep1[p.first + k]}));
}
for (auto &p : rep2) {
if (!rep2.count(p.first + k)) continue;
e2.push_back(add_and({p.second, rep2[p.first + k]}));
}
return add_or({add_or(e1), add_or(e2)});
}
void construct_network(int H, int W, int K) {
h = H; w = W;
if (K == H + W - 2) add_diagonals(K);
else add_xor({add_diagonals(K), add_diagonals(K + 1)});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
432 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
2568 KB |
on inputs (126, 120), (176, 169), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |