#include "vision.h"
int H, W, K;
int id(int x, int y){
return x * W + y;
}
int solve(int a[201], int b[201]){
std::vector<int> v1;
for(int i = 0; i <= (H + W - 2) - K; i++){
v1.push_back(add_and({a[i], a[i + K]}));
}
int a1 = add_or(v1);
std::vector<int> v2;
for(int i = 0; i <= H + W - 2; i++){
std::vector<int> v;
for(int j = std::max(0, i - K); j <= std::min(H + W - 2, i + K); j++){
if(j != i) v.push_back(b[j]);
}
v2.push_back(add_and({b[i], add_or(v)}));
v.clear();
for(int j = 0; j <= H + W - 2; j++){
if(j != i) v.push_back(b[j]);
}
v2.push_back(add_xor({b[i], add_or(v)}));
}
int a2 = add_or(v2);
return add_and({a1, a2});
}
void construct_network(int H, int W, int K) {
::H = H, ::W = W, ::K = K;
int a[H + W - 1], b[H + W - 1];
std::vector<int> va[H + W - 1], vb[H + W - 1];
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
va[i + j].push_back(id(i, j));
vb[i + (W - 1 - j)].push_back(id(i, j));
}
}
for(int i = 0; i <= H + W - 2; i++) a[i] = add_or(va[i]);
for(int i = 0; i <= H + W - 2; i++) b[i] = add_or(vb[i]);
int a1 = solve(a, b), a2 = solve(b, a);
add_or({a1, a2});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 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 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 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 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 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 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 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 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
1108 KB |
Output is correct |
2 |
Correct |
20 ms |
1544 KB |
Output is correct |
3 |
Correct |
19 ms |
1584 KB |
Output is correct |
4 |
Correct |
16 ms |
1620 KB |
Output is correct |
5 |
Correct |
10 ms |
1108 KB |
Output is correct |
6 |
Correct |
13 ms |
1456 KB |
Output is correct |
7 |
Correct |
21 ms |
1620 KB |
Output is correct |
8 |
Correct |
20 ms |
1620 KB |
Output is correct |
9 |
Correct |
9 ms |
1108 KB |
Output is correct |
10 |
Correct |
11 ms |
1364 KB |
Output is correct |
11 |
Correct |
14 ms |
1492 KB |
Output is correct |
12 |
Correct |
15 ms |
1492 KB |
Output is correct |
13 |
Correct |
16 ms |
1620 KB |
Output is correct |
14 |
Correct |
16 ms |
1664 KB |
Output is correct |
15 |
Correct |
10 ms |
1096 KB |
Output is correct |
16 |
Correct |
14 ms |
1360 KB |
Output is correct |
17 |
Correct |
17 ms |
1496 KB |
Output is correct |
18 |
Correct |
20 ms |
1584 KB |
Output is correct |
19 |
Correct |
16 ms |
1620 KB |
Output is correct |
20 |
Correct |
16 ms |
1708 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
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 |
5 ms |
724 KB |
Output is correct |
4 |
Correct |
10 ms |
852 KB |
Output is correct |
5 |
Correct |
7 ms |
980 KB |
Output is correct |
6 |
Correct |
7 ms |
980 KB |
Output is correct |
7 |
Correct |
8 ms |
960 KB |
Output is correct |
8 |
Correct |
8 ms |
1236 KB |
Output is correct |
9 |
Correct |
17 ms |
1492 KB |
Output is correct |
10 |
Correct |
13 ms |
1596 KB |
Output is correct |
11 |
Correct |
15 ms |
1620 KB |
Output is correct |
12 |
Correct |
15 ms |
1620 KB |
Output is correct |
13 |
Correct |
10 ms |
1108 KB |
Output is correct |
14 |
Correct |
18 ms |
1340 KB |
Output is correct |
15 |
Correct |
16 ms |
1580 KB |
Output is correct |
16 |
Correct |
16 ms |
1648 KB |
Output is correct |
17 |
Correct |
13 ms |
1064 KB |
Output is correct |
18 |
Correct |
14 ms |
1520 KB |
Output is correct |
19 |
Correct |
16 ms |
1684 KB |
Output is correct |
20 |
Correct |
25 ms |
2900 KB |
Output is correct |
21 |
Incorrect |
33 ms |
3956 KB |
on inputs (0, 0), (199, 99), expected 0, but computed 1 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
41 ms |
5064 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 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 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |