#include<bits/stdc++.h>
#include "vision.h"
using namespace std;
const int N = 2e5 + 5;
int id_or[N], id_xor[N], cur;
vector<int> X;/*
void add_and(vector<int> Ns) {
int x = 1;
for(int i = 0; i < Ns.size(); i++) {
x &= X[Ns[i]];
}
X.push_back(x);
}
void add_or(vector<int> Ns) {
int x = 0;
for(int i = 0; i < Ns.size(); i++) {
x |= X[Ns[i]];
}
X.push_back(x);
}
void add_xor(vector<int> Ns) {
int x = 0;
for(int i = 0; i < Ns.size(); i++) {
x ^= X[Ns[i]];
}
X.push_back(x);
}
void add_not(int N) {
X.push_back(1^X[N]);
}
*/
vector<int> d[N];
int go(int n, int k) {
vector<int> V;
for(int i = 0; i < n; i++) {
id_or[i] = ++cur; add_or(d[i]);
id_xor[i] = ++cur; add_xor(d[i]);
add_not(cur); ++cur;
add_and({cur, id_or[i]});
V.push_back(++cur);
}
for(int i = k; i < n; i++) {
vector<int> v;
for(int j = i - k ; j <= i; j++) {
v.push_back(id_or[j]);
}
++cur;
add_or(v);
++cur;
add_xor(v);
add_not(cur); ++cur;
add_and({cur, cur - 2}); ++cur;
V.push_back(cur);
}
add_or(V); ++cur;
return cur;
}
void calc(int n, int m,int k) {
for(int i = 0; i < n + m; i++) d[i].clear();
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
d[i - j + m - 1].push_back(i * m + j);
}
}
int id1 = go(n + m - 1, k);
for(int i = 0; i < n + m; i++) {
d[i].clear();
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
d[i + j].push_back(i * m + j);
}
}
int id2 = go(n + m - 1, k);
add_and({id1, id2}); ++cur;
}
void construct_network(int H, int W, int K) {
cur = H * W; --cur;
calc(H, W, K);
int pcur = cur;
calc(H, W, K - 1);
add_xor({pcur, cur});
}
/*
int main() {
int H, W, K;
assert(3 == scanf("%d%d%d", &H, &W, &K));
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
int a;
cin >> a;
X.push_back(a);
}
}
construct_network(H, W, K);
cout << X.back() << endl;
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5008 KB |
Output is correct |
4 |
Correct |
4 ms |
5008 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5008 KB |
Output is correct |
14 |
Correct |
4 ms |
5008 KB |
Output is correct |
15 |
Correct |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
5004 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
4 ms |
5008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5008 KB |
Output is correct |
4 |
Correct |
4 ms |
5008 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5008 KB |
Output is correct |
14 |
Correct |
4 ms |
5008 KB |
Output is correct |
15 |
Correct |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
5004 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
4 ms |
5008 KB |
Output is correct |
19 |
Correct |
3 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
4948 KB |
Output is correct |
21 |
Correct |
4 ms |
5004 KB |
Output is correct |
22 |
Correct |
3 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
3 ms |
4948 KB |
Output is correct |
25 |
Correct |
3 ms |
4948 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
3 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5008 KB |
Output is correct |
4 |
Correct |
4 ms |
5008 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5008 KB |
Output is correct |
14 |
Correct |
4 ms |
5008 KB |
Output is correct |
15 |
Correct |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
5004 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
4 ms |
5008 KB |
Output is correct |
19 |
Correct |
3 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
4948 KB |
Output is correct |
21 |
Correct |
4 ms |
5004 KB |
Output is correct |
22 |
Correct |
3 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
3 ms |
4948 KB |
Output is correct |
25 |
Correct |
3 ms |
4948 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
3 ms |
4948 KB |
Output is correct |
28 |
Correct |
5 ms |
5204 KB |
Output is correct |
29 |
Correct |
3 ms |
5076 KB |
Output is correct |
30 |
Correct |
3 ms |
5076 KB |
Output is correct |
31 |
Correct |
4 ms |
5008 KB |
Output is correct |
32 |
Correct |
5 ms |
5112 KB |
Output is correct |
33 |
Correct |
4 ms |
5204 KB |
Output is correct |
34 |
Correct |
5 ms |
5136 KB |
Output is correct |
35 |
Correct |
7 ms |
5204 KB |
Output is correct |
36 |
Correct |
5 ms |
5204 KB |
Output is correct |
37 |
Correct |
3 ms |
5132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5008 KB |
Output is correct |
4 |
Correct |
4 ms |
5008 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5008 KB |
Output is correct |
14 |
Correct |
4 ms |
5008 KB |
Output is correct |
15 |
Correct |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
5004 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
4 ms |
5008 KB |
Output is correct |
19 |
Correct |
3 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
4948 KB |
Output is correct |
21 |
Correct |
4 ms |
5004 KB |
Output is correct |
22 |
Correct |
3 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
3 ms |
4948 KB |
Output is correct |
25 |
Correct |
3 ms |
4948 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
3 ms |
4948 KB |
Output is correct |
28 |
Correct |
5 ms |
5204 KB |
Output is correct |
29 |
Correct |
3 ms |
5076 KB |
Output is correct |
30 |
Correct |
3 ms |
5076 KB |
Output is correct |
31 |
Correct |
4 ms |
5008 KB |
Output is correct |
32 |
Correct |
5 ms |
5112 KB |
Output is correct |
33 |
Correct |
4 ms |
5204 KB |
Output is correct |
34 |
Correct |
5 ms |
5136 KB |
Output is correct |
35 |
Correct |
7 ms |
5204 KB |
Output is correct |
36 |
Correct |
5 ms |
5204 KB |
Output is correct |
37 |
Correct |
3 ms |
5132 KB |
Output is correct |
38 |
Correct |
18 ms |
6668 KB |
Output is correct |
39 |
Correct |
5 ms |
5260 KB |
Output is correct |
40 |
Correct |
5 ms |
5264 KB |
Output is correct |
41 |
Correct |
9 ms |
5712 KB |
Output is correct |
42 |
Correct |
7 ms |
5592 KB |
Output is correct |
43 |
Correct |
13 ms |
6224 KB |
Output is correct |
44 |
Correct |
18 ms |
6656 KB |
Output is correct |
45 |
Correct |
21 ms |
6788 KB |
Output is correct |
46 |
Correct |
24 ms |
6612 KB |
Output is correct |
47 |
Correct |
11 ms |
5912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
5456 KB |
Output is correct |
2 |
Correct |
13 ms |
6052 KB |
Output is correct |
3 |
Correct |
12 ms |
5968 KB |
Output is correct |
4 |
Correct |
4 ms |
5316 KB |
Output is correct |
5 |
Correct |
6 ms |
5456 KB |
Output is correct |
6 |
Correct |
11 ms |
5936 KB |
Output is correct |
7 |
Correct |
11 ms |
5840 KB |
Output is correct |
8 |
Correct |
5 ms |
5204 KB |
Output is correct |
9 |
Correct |
7 ms |
5516 KB |
Output is correct |
10 |
Correct |
12 ms |
5876 KB |
Output is correct |
11 |
Correct |
13 ms |
6008 KB |
Output is correct |
12 |
Correct |
13 ms |
5968 KB |
Output is correct |
13 |
Correct |
12 ms |
5772 KB |
Output is correct |
14 |
Correct |
5 ms |
5204 KB |
Output is correct |
15 |
Correct |
7 ms |
5492 KB |
Output is correct |
16 |
Correct |
12 ms |
5896 KB |
Output is correct |
17 |
Correct |
12 ms |
6040 KB |
Output is correct |
18 |
Correct |
13 ms |
6028 KB |
Output is correct |
19 |
Correct |
10 ms |
5740 KB |
Output is correct |
20 |
Correct |
4 ms |
5204 KB |
Output is correct |
21 |
Correct |
3 ms |
4948 KB |
Output is correct |
22 |
Correct |
3 ms |
4996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
5004 KB |
Output is correct |
2 |
Correct |
3 ms |
5012 KB |
Output is correct |
3 |
Correct |
7 ms |
5460 KB |
Output is correct |
4 |
Correct |
9 ms |
5588 KB |
Output is correct |
5 |
Correct |
9 ms |
5716 KB |
Output is correct |
6 |
Correct |
9 ms |
5588 KB |
Output is correct |
7 |
Correct |
6 ms |
5332 KB |
Output is correct |
8 |
Correct |
10 ms |
5840 KB |
Output is correct |
9 |
Correct |
15 ms |
6160 KB |
Output is correct |
10 |
Correct |
16 ms |
6320 KB |
Output is correct |
11 |
Correct |
15 ms |
6044 KB |
Output is correct |
12 |
Correct |
12 ms |
5588 KB |
Output is correct |
13 |
Correct |
6 ms |
5388 KB |
Output is correct |
14 |
Correct |
12 ms |
5884 KB |
Output is correct |
15 |
Correct |
11 ms |
5880 KB |
Output is correct |
16 |
Correct |
5 ms |
5204 KB |
Output is correct |
17 |
Correct |
6 ms |
5516 KB |
Output is correct |
18 |
Correct |
12 ms |
5968 KB |
Output is correct |
19 |
Correct |
4 ms |
5204 KB |
Output is correct |
20 |
Correct |
23 ms |
7296 KB |
Output is correct |
21 |
Correct |
37 ms |
8728 KB |
Output is correct |
22 |
Correct |
38 ms |
8648 KB |
Output is correct |
23 |
Correct |
20 ms |
6992 KB |
Output is correct |
24 |
Correct |
22 ms |
7304 KB |
Output is correct |
25 |
Correct |
39 ms |
8864 KB |
Output is correct |
26 |
Correct |
25 ms |
6944 KB |
Output is correct |
27 |
Incorrect |
6 ms |
6864 KB |
WA in grader: Too many instructions |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
6940 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5008 KB |
Output is correct |
4 |
Correct |
4 ms |
5008 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
3 ms |
5008 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5008 KB |
Output is correct |
14 |
Correct |
4 ms |
5008 KB |
Output is correct |
15 |
Correct |
3 ms |
4948 KB |
Output is correct |
16 |
Correct |
3 ms |
5004 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
4 ms |
5008 KB |
Output is correct |
19 |
Correct |
3 ms |
4948 KB |
Output is correct |
20 |
Correct |
3 ms |
4948 KB |
Output is correct |
21 |
Correct |
4 ms |
5004 KB |
Output is correct |
22 |
Correct |
3 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
5076 KB |
Output is correct |
24 |
Correct |
3 ms |
4948 KB |
Output is correct |
25 |
Correct |
3 ms |
4948 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
3 ms |
4948 KB |
Output is correct |
28 |
Correct |
5 ms |
5204 KB |
Output is correct |
29 |
Correct |
3 ms |
5076 KB |
Output is correct |
30 |
Correct |
3 ms |
5076 KB |
Output is correct |
31 |
Correct |
4 ms |
5008 KB |
Output is correct |
32 |
Correct |
5 ms |
5112 KB |
Output is correct |
33 |
Correct |
4 ms |
5204 KB |
Output is correct |
34 |
Correct |
5 ms |
5136 KB |
Output is correct |
35 |
Correct |
7 ms |
5204 KB |
Output is correct |
36 |
Correct |
5 ms |
5204 KB |
Output is correct |
37 |
Correct |
3 ms |
5132 KB |
Output is correct |
38 |
Correct |
18 ms |
6668 KB |
Output is correct |
39 |
Correct |
5 ms |
5260 KB |
Output is correct |
40 |
Correct |
5 ms |
5264 KB |
Output is correct |
41 |
Correct |
9 ms |
5712 KB |
Output is correct |
42 |
Correct |
7 ms |
5592 KB |
Output is correct |
43 |
Correct |
13 ms |
6224 KB |
Output is correct |
44 |
Correct |
18 ms |
6656 KB |
Output is correct |
45 |
Correct |
21 ms |
6788 KB |
Output is correct |
46 |
Correct |
24 ms |
6612 KB |
Output is correct |
47 |
Correct |
11 ms |
5912 KB |
Output is correct |
48 |
Correct |
6 ms |
5456 KB |
Output is correct |
49 |
Correct |
13 ms |
6052 KB |
Output is correct |
50 |
Correct |
12 ms |
5968 KB |
Output is correct |
51 |
Correct |
4 ms |
5316 KB |
Output is correct |
52 |
Correct |
6 ms |
5456 KB |
Output is correct |
53 |
Correct |
11 ms |
5936 KB |
Output is correct |
54 |
Correct |
11 ms |
5840 KB |
Output is correct |
55 |
Correct |
5 ms |
5204 KB |
Output is correct |
56 |
Correct |
7 ms |
5516 KB |
Output is correct |
57 |
Correct |
12 ms |
5876 KB |
Output is correct |
58 |
Correct |
13 ms |
6008 KB |
Output is correct |
59 |
Correct |
13 ms |
5968 KB |
Output is correct |
60 |
Correct |
12 ms |
5772 KB |
Output is correct |
61 |
Correct |
5 ms |
5204 KB |
Output is correct |
62 |
Correct |
7 ms |
5492 KB |
Output is correct |
63 |
Correct |
12 ms |
5896 KB |
Output is correct |
64 |
Correct |
12 ms |
6040 KB |
Output is correct |
65 |
Correct |
13 ms |
6028 KB |
Output is correct |
66 |
Correct |
10 ms |
5740 KB |
Output is correct |
67 |
Correct |
4 ms |
5204 KB |
Output is correct |
68 |
Correct |
3 ms |
4948 KB |
Output is correct |
69 |
Correct |
3 ms |
4996 KB |
Output is correct |
70 |
Correct |
4 ms |
5004 KB |
Output is correct |
71 |
Correct |
3 ms |
5012 KB |
Output is correct |
72 |
Correct |
7 ms |
5460 KB |
Output is correct |
73 |
Correct |
9 ms |
5588 KB |
Output is correct |
74 |
Correct |
9 ms |
5716 KB |
Output is correct |
75 |
Correct |
9 ms |
5588 KB |
Output is correct |
76 |
Correct |
6 ms |
5332 KB |
Output is correct |
77 |
Correct |
10 ms |
5840 KB |
Output is correct |
78 |
Correct |
15 ms |
6160 KB |
Output is correct |
79 |
Correct |
16 ms |
6320 KB |
Output is correct |
80 |
Correct |
15 ms |
6044 KB |
Output is correct |
81 |
Correct |
12 ms |
5588 KB |
Output is correct |
82 |
Correct |
6 ms |
5388 KB |
Output is correct |
83 |
Correct |
12 ms |
5884 KB |
Output is correct |
84 |
Correct |
11 ms |
5880 KB |
Output is correct |
85 |
Correct |
5 ms |
5204 KB |
Output is correct |
86 |
Correct |
6 ms |
5516 KB |
Output is correct |
87 |
Correct |
12 ms |
5968 KB |
Output is correct |
88 |
Correct |
4 ms |
5204 KB |
Output is correct |
89 |
Correct |
23 ms |
7296 KB |
Output is correct |
90 |
Correct |
37 ms |
8728 KB |
Output is correct |
91 |
Correct |
38 ms |
8648 KB |
Output is correct |
92 |
Correct |
20 ms |
6992 KB |
Output is correct |
93 |
Correct |
22 ms |
7304 KB |
Output is correct |
94 |
Correct |
39 ms |
8864 KB |
Output is correct |
95 |
Correct |
25 ms |
6944 KB |
Output is correct |
96 |
Incorrect |
6 ms |
6864 KB |
WA in grader: Too many instructions |
97 |
Halted |
0 ms |
0 KB |
- |