#include "vision.h"
#include <bits/stdc++.h>
#ifdef __LOCAL__
#include <debug_local.h>
#endif
using namespace std;
void construct_network(int H, int W, int K) {
vector<int> posleft(H + W), posxorleft(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (i + j == diag) {
v.push_back(i * W + j);
}
}
}
posleft[diag] = add_or(v);
posxorleft[diag] = add_xor(v);
}
vector<int> posright(H + W), posxorright(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (j - i + H - 1 == diag) {
v.push_back(i * W + j);
}
}
}
posright[diag] = add_or(v);
posxorright[diag] = add_xor(v);
}
vector<int> hastwoleft(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v1, v2;
for (int d = diag; d <= min(H + W - 2, diag + 2 * K); d++) {
v1.push_back(posleft[d]);
v2.push_back(posxorleft[d]);
}
int orr = add_or(v1);
int xorr = add_xor(v2);
hastwoleft[diag] = add_and({orr, add_not(xorr)});
}
vector<int> hastworight(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v1, v2;
for (int d = diag; d <= min(H + W - 2, diag + 2 * K); d++) {
v1.push_back(posright[d]);
v2.push_back(posxorright[d]);
}
int orr = add_or(v1);
int xorr = add_xor(v2);
hastworight[diag] = add_and({orr, add_not(xorr)});
}
vector<int> twodiagleft(H + W);
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
twodiagleft[diag] = add_and({posleft[diag], posleft[diag + K]});
}
vector<int> twodiagright(H + W);
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
twodiagright[diag] = add_and({posright[diag], posright[diag + K]});
}
int first;
{
vector<int> v;
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
v.push_back(twodiagleft[diag]);
}
int f1 = add_or(v);
v.clear();
for (int diag = 0; diag <= H + W - 2; diag++) {
v.push_back(hastworight[diag]);
}
int f2 = add_or(v);
first = add_and({f1, f2});
}
int second;
{
vector<int> v;
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
v.push_back(twodiagright[diag]);
}
int f1 = add_or(v);
v.clear();
for (int diag = 0; diag <= H + W - 2; diag++) {
v.push_back(hastwoleft[diag]);
}
int f2 = add_or(v);
second = add_and({f1, f2});
}
add_or({first, second});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 3), (1, 0), expected 0, but computed 1 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 3), (1, 0), expected 0, but computed 1 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 3), (1, 0), expected 0, but computed 1 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
11 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
1108 KB |
Output is correct |
4 |
Correct |
10 ms |
1108 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
8 ms |
980 KB |
Output is correct |
7 |
Correct |
9 ms |
1096 KB |
Output is correct |
8 |
Correct |
9 ms |
1108 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
7 ms |
980 KB |
Output is correct |
11 |
Correct |
10 ms |
1140 KB |
Output is correct |
12 |
Correct |
11 ms |
1108 KB |
Output is correct |
13 |
Correct |
12 ms |
1132 KB |
Output is correct |
14 |
Correct |
9 ms |
1108 KB |
Output is correct |
15 |
Correct |
2 ms |
468 KB |
Output is correct |
16 |
Correct |
7 ms |
980 KB |
Output is correct |
17 |
Correct |
11 ms |
1068 KB |
Output is correct |
18 |
Correct |
9 ms |
1116 KB |
Output is correct |
19 |
Correct |
9 ms |
1108 KB |
Output is correct |
20 |
Correct |
8 ms |
1108 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
468 KB |
Output is correct |
4 |
Correct |
5 ms |
724 KB |
Output is correct |
5 |
Correct |
8 ms |
728 KB |
Output is correct |
6 |
Correct |
8 ms |
724 KB |
Output is correct |
7 |
Correct |
5 ms |
724 KB |
Output is correct |
8 |
Correct |
5 ms |
676 KB |
Output is correct |
9 |
Correct |
9 ms |
1108 KB |
Output is correct |
10 |
Correct |
13 ms |
1236 KB |
Output is correct |
11 |
Correct |
10 ms |
1236 KB |
Output is correct |
12 |
Correct |
10 ms |
1264 KB |
Output is correct |
13 |
Correct |
2 ms |
468 KB |
Output is correct |
14 |
Correct |
8 ms |
1088 KB |
Output is correct |
15 |
Correct |
12 ms |
1056 KB |
Output is correct |
16 |
Correct |
10 ms |
1128 KB |
Output is correct |
17 |
Correct |
2 ms |
468 KB |
Output is correct |
18 |
Correct |
9 ms |
1108 KB |
Output is correct |
19 |
Correct |
9 ms |
1108 KB |
Output is correct |
20 |
Correct |
16 ms |
1360 KB |
Output is correct |
21 |
Correct |
30 ms |
2900 KB |
Output is correct |
22 |
Correct |
36 ms |
3096 KB |
Output is correct |
23 |
Correct |
43 ms |
3020 KB |
Output is correct |
24 |
Correct |
15 ms |
1360 KB |
Output is correct |
25 |
Correct |
31 ms |
3040 KB |
Output is correct |
26 |
Correct |
33 ms |
2988 KB |
Output is correct |
27 |
Correct |
33 ms |
2248 KB |
Output is correct |
28 |
Correct |
60 ms |
4544 KB |
Output is correct |
29 |
Correct |
83 ms |
5376 KB |
Output is correct |
30 |
Correct |
60 ms |
5284 KB |
Output is correct |
31 |
Correct |
60 ms |
5264 KB |
Output is correct |
32 |
Correct |
0 ms |
212 KB |
Output is correct |
33 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2192 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
468 KB |
Output is correct |
4 |
Correct |
5 ms |
724 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Correct |
17 ms |
1360 KB |
Output is correct |
8 |
Correct |
20 ms |
1308 KB |
Output is correct |
9 |
Correct |
32 ms |
2268 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 3), (1, 0), expected 0, but computed 1 |
22 |
Halted |
0 ms |
0 KB |
- |