#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 3e2;
vector<int> vv[MAXN];
map<int, vector<int>> left_diagonal, right_diagonal;
int solve(int H, int W, int K){
vector<int> Ns, vec;
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
if (left_diagonal[i + j].front() != i * W + j) continue;
Ns.clear();
for (int x = 0; x < K; x++){
for (int y : left_diagonal[i + j - x]) Ns.push_back(y);
}
int ind1 = add_or(Ns), ind2 = add_xor(Ns);
ind2 = add_not(ind2);
int ind = add_and({ind1, ind2});
vec.push_back(ind);
}
}
int lf = add_or(vec);
vec.clear();
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
if (right_diagonal[i - j].back() != i * W + j) continue;
Ns.clear();
for (int x = 0; x < K; x++){
for (int y : right_diagonal[i - j - x]) Ns.push_back(y);
}
int ind1 = add_or(Ns), ind2 = add_xor(Ns);
ind2 = add_not(ind2);
int ind = add_and({ind1, ind2});
vec.push_back(ind);
}
}
int rg = add_or(vec);
return add_and({lf, rg});
}
void construct_network(int H, int W, int K) {
vector<int> Ns;
left_diagonal.clear();
right_diagonal.clear();
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
left_diagonal[i + j].push_back(i * W + j);
right_diagonal[i - j].push_back(i * W + j);
}
}
Ns = {solve(H, W, K + 1), solve(H, W, K)};
add_xor(Ns);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4940 KB |
Output is correct |
2 |
Correct |
3 ms |
4940 KB |
Output is correct |
3 |
Correct |
3 ms |
4940 KB |
Output is correct |
4 |
Correct |
3 ms |
4940 KB |
Output is correct |
5 |
Correct |
3 ms |
4944 KB |
Output is correct |
6 |
Correct |
3 ms |
4940 KB |
Output is correct |
7 |
Correct |
3 ms |
4940 KB |
Output is correct |
8 |
Correct |
3 ms |
4908 KB |
Output is correct |
9 |
Correct |
3 ms |
4940 KB |
Output is correct |
10 |
Correct |
3 ms |
4940 KB |
Output is correct |
11 |
Correct |
3 ms |
4940 KB |
Output is correct |
12 |
Correct |
3 ms |
4940 KB |
Output is correct |
13 |
Correct |
3 ms |
4940 KB |
Output is correct |
14 |
Correct |
3 ms |
4940 KB |
Output is correct |
15 |
Correct |
4 ms |
4996 KB |
Output is correct |
16 |
Correct |
4 ms |
4940 KB |
Output is correct |
17 |
Correct |
3 ms |
4940 KB |
Output is correct |
18 |
Correct |
3 ms |
4940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4940 KB |
Output is correct |
2 |
Correct |
3 ms |
4940 KB |
Output is correct |
3 |
Correct |
3 ms |
4940 KB |
Output is correct |
4 |
Correct |
3 ms |
4940 KB |
Output is correct |
5 |
Correct |
3 ms |
4944 KB |
Output is correct |
6 |
Correct |
3 ms |
4940 KB |
Output is correct |
7 |
Correct |
3 ms |
4940 KB |
Output is correct |
8 |
Correct |
3 ms |
4908 KB |
Output is correct |
9 |
Correct |
3 ms |
4940 KB |
Output is correct |
10 |
Correct |
3 ms |
4940 KB |
Output is correct |
11 |
Correct |
3 ms |
4940 KB |
Output is correct |
12 |
Correct |
3 ms |
4940 KB |
Output is correct |
13 |
Correct |
3 ms |
4940 KB |
Output is correct |
14 |
Correct |
3 ms |
4940 KB |
Output is correct |
15 |
Correct |
4 ms |
4996 KB |
Output is correct |
16 |
Correct |
4 ms |
4940 KB |
Output is correct |
17 |
Correct |
3 ms |
4940 KB |
Output is correct |
18 |
Correct |
3 ms |
4940 KB |
Output is correct |
19 |
Correct |
3 ms |
4940 KB |
Output is correct |
20 |
Correct |
3 ms |
4940 KB |
Output is correct |
21 |
Correct |
3 ms |
4940 KB |
Output is correct |
22 |
Correct |
4 ms |
4996 KB |
Output is correct |
23 |
Correct |
3 ms |
4996 KB |
Output is correct |
24 |
Correct |
4 ms |
4940 KB |
Output is correct |
25 |
Correct |
4 ms |
4996 KB |
Output is correct |
26 |
Correct |
4 ms |
5068 KB |
Output is correct |
27 |
Correct |
4 ms |
5068 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4940 KB |
Output is correct |
2 |
Correct |
3 ms |
4940 KB |
Output is correct |
3 |
Correct |
3 ms |
4940 KB |
Output is correct |
4 |
Correct |
3 ms |
4940 KB |
Output is correct |
5 |
Correct |
3 ms |
4944 KB |
Output is correct |
6 |
Correct |
3 ms |
4940 KB |
Output is correct |
7 |
Correct |
3 ms |
4940 KB |
Output is correct |
8 |
Correct |
3 ms |
4908 KB |
Output is correct |
9 |
Correct |
3 ms |
4940 KB |
Output is correct |
10 |
Correct |
3 ms |
4940 KB |
Output is correct |
11 |
Correct |
3 ms |
4940 KB |
Output is correct |
12 |
Correct |
3 ms |
4940 KB |
Output is correct |
13 |
Correct |
3 ms |
4940 KB |
Output is correct |
14 |
Correct |
3 ms |
4940 KB |
Output is correct |
15 |
Correct |
4 ms |
4996 KB |
Output is correct |
16 |
Correct |
4 ms |
4940 KB |
Output is correct |
17 |
Correct |
3 ms |
4940 KB |
Output is correct |
18 |
Correct |
3 ms |
4940 KB |
Output is correct |
19 |
Correct |
3 ms |
4940 KB |
Output is correct |
20 |
Correct |
3 ms |
4940 KB |
Output is correct |
21 |
Correct |
3 ms |
4940 KB |
Output is correct |
22 |
Correct |
4 ms |
4996 KB |
Output is correct |
23 |
Correct |
3 ms |
4996 KB |
Output is correct |
24 |
Correct |
4 ms |
4940 KB |
Output is correct |
25 |
Correct |
4 ms |
4996 KB |
Output is correct |
26 |
Correct |
4 ms |
5068 KB |
Output is correct |
27 |
Correct |
4 ms |
5068 KB |
Output is correct |
28 |
Correct |
21 ms |
5856 KB |
Output is correct |
29 |
Correct |
4 ms |
4940 KB |
Output is correct |
30 |
Correct |
4 ms |
4988 KB |
Output is correct |
31 |
Correct |
13 ms |
5708 KB |
Output is correct |
32 |
Correct |
6 ms |
5068 KB |
Output is correct |
33 |
Correct |
5 ms |
5068 KB |
Output is correct |
34 |
Correct |
15 ms |
5836 KB |
Output is correct |
35 |
Correct |
24 ms |
6476 KB |
Output is correct |
36 |
Correct |
32 ms |
6620 KB |
Output is correct |
37 |
Correct |
26 ms |
6732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4940 KB |
Output is correct |
2 |
Correct |
3 ms |
4940 KB |
Output is correct |
3 |
Correct |
3 ms |
4940 KB |
Output is correct |
4 |
Correct |
3 ms |
4940 KB |
Output is correct |
5 |
Correct |
3 ms |
4944 KB |
Output is correct |
6 |
Correct |
3 ms |
4940 KB |
Output is correct |
7 |
Correct |
3 ms |
4940 KB |
Output is correct |
8 |
Correct |
3 ms |
4908 KB |
Output is correct |
9 |
Correct |
3 ms |
4940 KB |
Output is correct |
10 |
Correct |
3 ms |
4940 KB |
Output is correct |
11 |
Correct |
3 ms |
4940 KB |
Output is correct |
12 |
Correct |
3 ms |
4940 KB |
Output is correct |
13 |
Correct |
3 ms |
4940 KB |
Output is correct |
14 |
Correct |
3 ms |
4940 KB |
Output is correct |
15 |
Correct |
4 ms |
4996 KB |
Output is correct |
16 |
Correct |
4 ms |
4940 KB |
Output is correct |
17 |
Correct |
3 ms |
4940 KB |
Output is correct |
18 |
Correct |
3 ms |
4940 KB |
Output is correct |
19 |
Correct |
3 ms |
4940 KB |
Output is correct |
20 |
Correct |
3 ms |
4940 KB |
Output is correct |
21 |
Correct |
3 ms |
4940 KB |
Output is correct |
22 |
Correct |
4 ms |
4996 KB |
Output is correct |
23 |
Correct |
3 ms |
4996 KB |
Output is correct |
24 |
Correct |
4 ms |
4940 KB |
Output is correct |
25 |
Correct |
4 ms |
4996 KB |
Output is correct |
26 |
Correct |
4 ms |
5068 KB |
Output is correct |
27 |
Correct |
4 ms |
5068 KB |
Output is correct |
28 |
Correct |
21 ms |
5856 KB |
Output is correct |
29 |
Correct |
4 ms |
4940 KB |
Output is correct |
30 |
Correct |
4 ms |
4988 KB |
Output is correct |
31 |
Correct |
13 ms |
5708 KB |
Output is correct |
32 |
Correct |
6 ms |
5068 KB |
Output is correct |
33 |
Correct |
5 ms |
5068 KB |
Output is correct |
34 |
Correct |
15 ms |
5836 KB |
Output is correct |
35 |
Correct |
24 ms |
6476 KB |
Output is correct |
36 |
Correct |
32 ms |
6620 KB |
Output is correct |
37 |
Correct |
26 ms |
6732 KB |
Output is correct |
38 |
Incorrect |
11 ms |
9096 KB |
WA in grader: Too many inputs |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
5196 KB |
Output is correct |
2 |
Correct |
19 ms |
6168 KB |
Output is correct |
3 |
Correct |
19 ms |
6140 KB |
Output is correct |
4 |
Correct |
25 ms |
6376 KB |
Output is correct |
5 |
Correct |
5 ms |
5256 KB |
Output is correct |
6 |
Correct |
15 ms |
5908 KB |
Output is correct |
7 |
Correct |
21 ms |
6276 KB |
Output is correct |
8 |
Correct |
35 ms |
6340 KB |
Output is correct |
9 |
Correct |
6 ms |
5324 KB |
Output is correct |
10 |
Correct |
12 ms |
5708 KB |
Output is correct |
11 |
Correct |
18 ms |
6172 KB |
Output is correct |
12 |
Correct |
18 ms |
6092 KB |
Output is correct |
13 |
Correct |
22 ms |
6348 KB |
Output is correct |
14 |
Correct |
25 ms |
6384 KB |
Output is correct |
15 |
Correct |
6 ms |
5324 KB |
Output is correct |
16 |
Correct |
16 ms |
5708 KB |
Output is correct |
17 |
Correct |
19 ms |
6092 KB |
Output is correct |
18 |
Correct |
22 ms |
6100 KB |
Output is correct |
19 |
Correct |
23 ms |
6256 KB |
Output is correct |
20 |
Correct |
24 ms |
6388 KB |
Output is correct |
21 |
Correct |
5 ms |
4940 KB |
Output is correct |
22 |
Correct |
3 ms |
5000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
3 ms |
4940 KB |
Output is correct |
3 |
Correct |
8 ms |
5452 KB |
Output is correct |
4 |
Correct |
79 ms |
11108 KB |
Output is correct |
5 |
Incorrect |
9 ms |
9036 KB |
WA in grader: Too many inputs |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
67 ms |
10528 KB |
Output is correct |
2 |
Correct |
3 ms |
5000 KB |
Output is correct |
3 |
Correct |
8 ms |
5500 KB |
Output is correct |
4 |
Correct |
19 ms |
5856 KB |
Output is correct |
5 |
Correct |
6 ms |
5216 KB |
Output is correct |
6 |
Correct |
5 ms |
5324 KB |
Output is correct |
7 |
Correct |
35 ms |
7740 KB |
Output is correct |
8 |
Correct |
37 ms |
7820 KB |
Output is correct |
9 |
Correct |
66 ms |
10616 KB |
Output is correct |
10 |
Correct |
3 ms |
4996 KB |
Output is correct |
11 |
Correct |
3 ms |
4940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4940 KB |
Output is correct |
2 |
Correct |
3 ms |
4940 KB |
Output is correct |
3 |
Correct |
3 ms |
4940 KB |
Output is correct |
4 |
Correct |
3 ms |
4940 KB |
Output is correct |
5 |
Correct |
3 ms |
4944 KB |
Output is correct |
6 |
Correct |
3 ms |
4940 KB |
Output is correct |
7 |
Correct |
3 ms |
4940 KB |
Output is correct |
8 |
Correct |
3 ms |
4908 KB |
Output is correct |
9 |
Correct |
3 ms |
4940 KB |
Output is correct |
10 |
Correct |
3 ms |
4940 KB |
Output is correct |
11 |
Correct |
3 ms |
4940 KB |
Output is correct |
12 |
Correct |
3 ms |
4940 KB |
Output is correct |
13 |
Correct |
3 ms |
4940 KB |
Output is correct |
14 |
Correct |
3 ms |
4940 KB |
Output is correct |
15 |
Correct |
4 ms |
4996 KB |
Output is correct |
16 |
Correct |
4 ms |
4940 KB |
Output is correct |
17 |
Correct |
3 ms |
4940 KB |
Output is correct |
18 |
Correct |
3 ms |
4940 KB |
Output is correct |
19 |
Correct |
3 ms |
4940 KB |
Output is correct |
20 |
Correct |
3 ms |
4940 KB |
Output is correct |
21 |
Correct |
3 ms |
4940 KB |
Output is correct |
22 |
Correct |
4 ms |
4996 KB |
Output is correct |
23 |
Correct |
3 ms |
4996 KB |
Output is correct |
24 |
Correct |
4 ms |
4940 KB |
Output is correct |
25 |
Correct |
4 ms |
4996 KB |
Output is correct |
26 |
Correct |
4 ms |
5068 KB |
Output is correct |
27 |
Correct |
4 ms |
5068 KB |
Output is correct |
28 |
Correct |
21 ms |
5856 KB |
Output is correct |
29 |
Correct |
4 ms |
4940 KB |
Output is correct |
30 |
Correct |
4 ms |
4988 KB |
Output is correct |
31 |
Correct |
13 ms |
5708 KB |
Output is correct |
32 |
Correct |
6 ms |
5068 KB |
Output is correct |
33 |
Correct |
5 ms |
5068 KB |
Output is correct |
34 |
Correct |
15 ms |
5836 KB |
Output is correct |
35 |
Correct |
24 ms |
6476 KB |
Output is correct |
36 |
Correct |
32 ms |
6620 KB |
Output is correct |
37 |
Correct |
26 ms |
6732 KB |
Output is correct |
38 |
Incorrect |
11 ms |
9096 KB |
WA in grader: Too many inputs |
39 |
Halted |
0 ms |
0 KB |
- |