#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 zr2[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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2176 KB |
Output is correct |
3 |
Correct |
2 ms |
2176 KB |
Output is correct |
4 |
Correct |
2 ms |
2176 KB |
Output is correct |
5 |
Correct |
2 ms |
2336 KB |
Output is correct |
6 |
Correct |
2 ms |
2176 KB |
Output is correct |
7 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2176 KB |
Output is correct |
3 |
Correct |
2 ms |
2176 KB |
Output is correct |
4 |
Correct |
2 ms |
2176 KB |
Output is correct |
5 |
Correct |
2 ms |
2336 KB |
Output is correct |
6 |
Correct |
2 ms |
2176 KB |
Output is correct |
7 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2176 KB |
Output is correct |
3 |
Correct |
2 ms |
2176 KB |
Output is correct |
4 |
Correct |
2 ms |
2176 KB |
Output is correct |
5 |
Correct |
2 ms |
2336 KB |
Output is correct |
6 |
Correct |
2 ms |
2176 KB |
Output is correct |
7 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2176 KB |
Output is correct |
3 |
Correct |
2 ms |
2176 KB |
Output is correct |
4 |
Correct |
2 ms |
2176 KB |
Output is correct |
5 |
Correct |
2 ms |
2336 KB |
Output is correct |
6 |
Correct |
2 ms |
2176 KB |
Output is correct |
7 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2432 KB |
Output is correct |
2 |
Correct |
4 ms |
2432 KB |
Output is correct |
3 |
Correct |
3 ms |
2432 KB |
Output is correct |
4 |
Correct |
3 ms |
2304 KB |
Output is correct |
5 |
Correct |
3 ms |
2432 KB |
Output is correct |
6 |
Correct |
3 ms |
2432 KB |
Output is correct |
7 |
Correct |
4 ms |
2432 KB |
Output is correct |
8 |
Correct |
2 ms |
2304 KB |
Output is correct |
9 |
Correct |
3 ms |
2432 KB |
Output is correct |
10 |
Correct |
3 ms |
2432 KB |
Output is correct |
11 |
Correct |
3 ms |
2432 KB |
Output is correct |
12 |
Correct |
3 ms |
2432 KB |
Output is correct |
13 |
Correct |
3 ms |
2432 KB |
Output is correct |
14 |
Correct |
2 ms |
2304 KB |
Output is correct |
15 |
Correct |
3 ms |
2432 KB |
Output is correct |
16 |
Correct |
3 ms |
2432 KB |
Output is correct |
17 |
Correct |
3 ms |
2432 KB |
Output is correct |
18 |
Correct |
3 ms |
2432 KB |
Output is correct |
19 |
Correct |
3 ms |
2432 KB |
Output is correct |
20 |
Correct |
2 ms |
2304 KB |
Output is correct |
21 |
Correct |
2 ms |
2176 KB |
Output is correct |
22 |
Correct |
2 ms |
2176 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2176 KB |
Output is correct |
2 |
Correct |
2 ms |
2176 KB |
Output is correct |
3 |
Incorrect |
3 ms |
3068 KB |
WA in grader: Too many instructions |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
3836 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2304 KB |
Output is correct |
2 |
Correct |
2 ms |
2176 KB |
Output is correct |
3 |
Correct |
2 ms |
2176 KB |
Output is correct |
4 |
Correct |
2 ms |
2176 KB |
Output is correct |
5 |
Correct |
2 ms |
2336 KB |
Output is correct |
6 |
Correct |
2 ms |
2176 KB |
Output is correct |
7 |
Incorrect |
2 ms |
2176 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |