#include "vision.h"
#include <bits/stdc++.h>
#define eb emplace_back
#define sz(V) ((int)(V).size())
using namespace std;
int dp1or[405], dp1xor[405];
int dp2or[405], dp2xor[405];
void construct_network(int H, int W, int K) {
for(int key = 0; key <= H+W-2; key++) {
vector<int> V;
for(int i = 0, j = key; i < H; i++, j--)
if(0 <= j && j < W) V.eb(i*W + j);
dp1or[key] = 1 == sz(V) ? V[0] : add_or(V);
dp1xor[key] = 1 == sz(V) ? V[0] : add_xor(V);
V.clear();
for(int i = 0, j = key-H+1; i < H; i++, j++)
if(0 <= j && j < W) V.eb(i*W + j);
dp2or[key] = 1 == sz(V) ? V[0] : add_or(V);
dp2xor[key] = 1 == sz(V) ? V[0] : add_xor(V);
}
auto make = [&]() -> int {
vector<int> AV, OV;
for(int i = K; i <= H+W-2; i++)
AV.eb(add_and({dp1or[i-K], dp1or[i]}));
for(int i = 0; i < H+W-2; i++) {
vector<int> V;
for(int j = min(i+K, H+W-2); i < j; j--) V.eb(dp2or[j]);
V.eb(dp2xor[i]);
OV.eb(add_and({dp2or[i], add_or(V)}));
}
return add_and({add_or(AV), add_or(OV)});
};
int ret = make();
for(int i = 0; i < 405; i++) {
swap(dp1or[i], dp2or[i]);
swap(dp1xor[i], dp2xor[i]);
}
add_or({ret, make()});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
6 ms |
632 KB |
Output is correct |
3 |
Correct |
6 ms |
632 KB |
Output is correct |
4 |
Correct |
7 ms |
760 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
632 KB |
Output is correct |
7 |
Correct |
6 ms |
632 KB |
Output is correct |
8 |
Correct |
7 ms |
632 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
632 KB |
Output is correct |
11 |
Correct |
6 ms |
632 KB |
Output is correct |
12 |
Correct |
6 ms |
632 KB |
Output is correct |
13 |
Correct |
6 ms |
632 KB |
Output is correct |
14 |
Correct |
7 ms |
632 KB |
Output is correct |
15 |
Correct |
3 ms |
504 KB |
Output is correct |
16 |
Correct |
5 ms |
632 KB |
Output is correct |
17 |
Correct |
6 ms |
632 KB |
Output is correct |
18 |
Correct |
6 ms |
632 KB |
Output is correct |
19 |
Correct |
6 ms |
632 KB |
Output is correct |
20 |
Correct |
7 ms |
632 KB |
Output is correct |
21 |
Correct |
2 ms |
256 KB |
Output is correct |
22 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2168 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 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |