#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)}));
}
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 - 1; i++) a[i] = add_or(va[i]);
for(int i = 0; i < H + W - 1; i++) b[i] = add_or(vb[i]);
int a1 = solve(a, b), a2 = solve(b, a);
add_or({a1, a2});
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
10 ms |
828 KB |
Output is correct |
3 |
Correct |
7 ms |
852 KB |
Output is correct |
4 |
Correct |
8 ms |
952 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
732 KB |
Output is correct |
7 |
Correct |
7 ms |
852 KB |
Output is correct |
8 |
Correct |
9 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
4 ms |
596 KB |
Output is correct |
11 |
Correct |
6 ms |
852 KB |
Output is correct |
12 |
Correct |
6 ms |
852 KB |
Output is correct |
13 |
Correct |
9 ms |
904 KB |
Output is correct |
14 |
Correct |
8 ms |
980 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
5 ms |
596 KB |
Output is correct |
17 |
Correct |
7 ms |
852 KB |
Output is correct |
18 |
Correct |
6 ms |
852 KB |
Output is correct |
19 |
Correct |
12 ms |
980 KB |
Output is correct |
20 |
Correct |
8 ms |
980 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
1748 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
3 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
420 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
6 ms |
1136 KB |
Output is correct |
8 |
Correct |
5 ms |
1108 KB |
Output is correct |
9 |
Correct |
11 ms |
1748 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |