#include "vision.h"
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#define N 205
using namespace std;
int h, w, k, T, en, mn = 2e9, mx, v[N][N], zl1[40005], zr1[405], zr2[405], zl2[40005], o1[405], o2[405];
int dr[4] = {-1, 0, 0, 1}, dc[4] = {0, -1, 1, 0};
set<int> vi[40005];
vector<int> ans, l1[405], l2[405];
queue<int> qr, qc, qe;
int pq_num(int p, int q) {
return p * w + q;
}
void pu(int p, int q, int e) {
if (p < 0 || p >= h || q < 0 || q >= w || v[p][q] == T) return;
v[p][q] = T;
qr.push(p);
qc.push(q);
qe.push(e);
}
vector<int> in;
void construct_network(int hh, int ww, int kk) {
int i, j, t1, t2, x1, x2;
h = hh;
w = ww;
k = kk;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
l1[i + j].push_back(pq_num(i, j));
l2[j - i + h - 1].push_back(pq_num(i, j));
}
}
for (i = 0; i < h + w - 1; i++) {
o1[i] = add_or(l1[i]);
o2[i] = add_or(l2[i]);
if (i > 0) zl1[i] = add_or({o1[i], zl1[i - 1]});
else zl1[i] = o1[i];
if (i > 0) zl2[i] = add_or({o2[i], zl2[i - 1]});
else zl2[i] = o2[i];
}
for (i = h + w - 2; i >= 0; i--) {
if (i + 1 < h + w - 2) zr1[i] = add_or({zr1[i + 1], o1[i]});
else zr1[i] = o1[i];
if (i + 1 < h + w - 2) zr2[i] = add_or({zr2[i + 1], o2[i]});
else zr1[i] = o2[i];
}
ans.clear();
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
t1 = i + j;
t2 = j - i + h - 1;
in.clear();
k = kk;
if (t1 - k >= 0) in.push_back(zl1[t1 - k]);
if (t1 + k <= h + w - 2) in.push_back(zr1[t1 + k]);
if (t2 - k >= 0) in.push_back(zl2[t2 - k]);
if (t2 + k <= h + w - 2) in.push_back(zr2[t2 + k]);
if (!in.empty()) x1 = add_or(in);
else x1 = -1;
if (x1 == -1) continue;
in.clear();
k = kk + 1;
if (t1 - k >= 0) in.push_back(zl1[t1 - k]);
if (t1 + k <= h + w - 2) in.push_back(zr1[t1 + k]);
if (t2 - k >= 0) in.push_back(zl2[t2 - k]);
if (t2 + k <= h + w - 2) in.push_back(zr2[t2 + k]);
if (!in.empty()) x2 = add_or(in);
else x2 = -1;
if (x2 == -1) ans.push_back(add_and({x1, pq_num(i, j)}));
else ans.push_back(add_and({add_xor({x1, x2}), pq_num(i, j), x1}));
}
}
add_or(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2176 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2176 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2176 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2176 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2432 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 |
2228 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 |
5 ms |
3836 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2176 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |