#include<bits/stdc++.h>
#include"vision.h"
using namespace std;
int h , w , k;
vector<int> Dl[400500] , Dr[400500];
int solve(int h , int w , int K){
for(int i = 0; i < h; ++i){
for(int j = 0; j < w; ++j){
// emplace back the elements on diagonals , position off memory array
Dl[i - j + w - 1].push_back(i * w + j);
Dr[i + j].push_back(i * w + j);
}
}
vector<int> DiagLor , DiagRor , prefLor , prefRor , ans;
for(int i = 0; i <= h + w - 2; ++i){
DiagLor.push_back(add_or(Dl[i]));
DiagRor.emplace_back(add_or(Dr[i]));
prefLor.push_back(add_or(DiagLor));
prefRor.push_back(add_or(DiagRor));
if(i >= K){
ans.push_back( add_and ( { DiagLor[i] , prefLor[i - K] } ) );
ans.push_back( add_and ( { DiagRor[i] , prefRor[i - K] } ) );
}
}
return add_or(ans);
}
void construct_network(int H , int W , int K){
if(H + W - 2 == K){
solve(H , W , K);
} else {
add_xor( { solve(H , W , K) , solve(H , W , K + 1) } );
}
}
//int main(){}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
19064 KB |
Output is correct |
2 |
Correct |
21 ms |
19192 KB |
Output is correct |
3 |
Correct |
21 ms |
19064 KB |
Output is correct |
4 |
Correct |
21 ms |
19064 KB |
Output is correct |
5 |
Correct |
20 ms |
19064 KB |
Output is correct |
6 |
Correct |
21 ms |
19064 KB |
Output is correct |
7 |
Correct |
20 ms |
19064 KB |
Output is correct |
8 |
Correct |
22 ms |
19064 KB |
Output is correct |
9 |
Correct |
22 ms |
19192 KB |
Output is correct |
10 |
Correct |
20 ms |
19192 KB |
Output is correct |
11 |
Correct |
21 ms |
19192 KB |
Output is correct |
12 |
Correct |
19 ms |
19064 KB |
Output is correct |
13 |
Correct |
21 ms |
19064 KB |
Output is correct |
14 |
Correct |
20 ms |
19192 KB |
Output is correct |
15 |
Correct |
21 ms |
19192 KB |
Output is correct |
16 |
Correct |
21 ms |
19192 KB |
Output is correct |
17 |
Correct |
21 ms |
19068 KB |
Output is correct |
18 |
Correct |
21 ms |
19192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
19064 KB |
Output is correct |
2 |
Correct |
21 ms |
19192 KB |
Output is correct |
3 |
Correct |
21 ms |
19064 KB |
Output is correct |
4 |
Correct |
21 ms |
19064 KB |
Output is correct |
5 |
Correct |
20 ms |
19064 KB |
Output is correct |
6 |
Correct |
21 ms |
19064 KB |
Output is correct |
7 |
Correct |
20 ms |
19064 KB |
Output is correct |
8 |
Correct |
22 ms |
19064 KB |
Output is correct |
9 |
Correct |
22 ms |
19192 KB |
Output is correct |
10 |
Correct |
20 ms |
19192 KB |
Output is correct |
11 |
Correct |
21 ms |
19192 KB |
Output is correct |
12 |
Correct |
19 ms |
19064 KB |
Output is correct |
13 |
Correct |
21 ms |
19064 KB |
Output is correct |
14 |
Correct |
20 ms |
19192 KB |
Output is correct |
15 |
Correct |
21 ms |
19192 KB |
Output is correct |
16 |
Correct |
21 ms |
19192 KB |
Output is correct |
17 |
Correct |
21 ms |
19068 KB |
Output is correct |
18 |
Correct |
21 ms |
19192 KB |
Output is correct |
19 |
Correct |
20 ms |
19064 KB |
Output is correct |
20 |
Correct |
20 ms |
19168 KB |
Output is correct |
21 |
Correct |
20 ms |
19192 KB |
Output is correct |
22 |
Correct |
21 ms |
19180 KB |
Output is correct |
23 |
Correct |
20 ms |
19192 KB |
Output is correct |
24 |
Correct |
20 ms |
19192 KB |
Output is correct |
25 |
Correct |
21 ms |
19192 KB |
Output is correct |
26 |
Correct |
21 ms |
19192 KB |
Output is correct |
27 |
Correct |
21 ms |
19064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
19064 KB |
Output is correct |
2 |
Correct |
21 ms |
19192 KB |
Output is correct |
3 |
Correct |
21 ms |
19064 KB |
Output is correct |
4 |
Correct |
21 ms |
19064 KB |
Output is correct |
5 |
Correct |
20 ms |
19064 KB |
Output is correct |
6 |
Correct |
21 ms |
19064 KB |
Output is correct |
7 |
Correct |
20 ms |
19064 KB |
Output is correct |
8 |
Correct |
22 ms |
19064 KB |
Output is correct |
9 |
Correct |
22 ms |
19192 KB |
Output is correct |
10 |
Correct |
20 ms |
19192 KB |
Output is correct |
11 |
Correct |
21 ms |
19192 KB |
Output is correct |
12 |
Correct |
19 ms |
19064 KB |
Output is correct |
13 |
Correct |
21 ms |
19064 KB |
Output is correct |
14 |
Correct |
20 ms |
19192 KB |
Output is correct |
15 |
Correct |
21 ms |
19192 KB |
Output is correct |
16 |
Correct |
21 ms |
19192 KB |
Output is correct |
17 |
Correct |
21 ms |
19068 KB |
Output is correct |
18 |
Correct |
21 ms |
19192 KB |
Output is correct |
19 |
Correct |
20 ms |
19064 KB |
Output is correct |
20 |
Correct |
20 ms |
19168 KB |
Output is correct |
21 |
Correct |
20 ms |
19192 KB |
Output is correct |
22 |
Correct |
21 ms |
19180 KB |
Output is correct |
23 |
Correct |
20 ms |
19192 KB |
Output is correct |
24 |
Correct |
20 ms |
19192 KB |
Output is correct |
25 |
Correct |
21 ms |
19192 KB |
Output is correct |
26 |
Correct |
21 ms |
19192 KB |
Output is correct |
27 |
Correct |
21 ms |
19064 KB |
Output is correct |
28 |
Correct |
23 ms |
19320 KB |
Output is correct |
29 |
Correct |
20 ms |
19192 KB |
Output is correct |
30 |
Correct |
21 ms |
19192 KB |
Output is correct |
31 |
Correct |
21 ms |
19192 KB |
Output is correct |
32 |
Correct |
21 ms |
19192 KB |
Output is correct |
33 |
Correct |
23 ms |
19320 KB |
Output is correct |
34 |
Correct |
23 ms |
19352 KB |
Output is correct |
35 |
Correct |
21 ms |
19320 KB |
Output is correct |
36 |
Correct |
22 ms |
19320 KB |
Output is correct |
37 |
Correct |
20 ms |
19192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
19064 KB |
Output is correct |
2 |
Correct |
21 ms |
19192 KB |
Output is correct |
3 |
Correct |
21 ms |
19064 KB |
Output is correct |
4 |
Correct |
21 ms |
19064 KB |
Output is correct |
5 |
Correct |
20 ms |
19064 KB |
Output is correct |
6 |
Correct |
21 ms |
19064 KB |
Output is correct |
7 |
Correct |
20 ms |
19064 KB |
Output is correct |
8 |
Correct |
22 ms |
19064 KB |
Output is correct |
9 |
Correct |
22 ms |
19192 KB |
Output is correct |
10 |
Correct |
20 ms |
19192 KB |
Output is correct |
11 |
Correct |
21 ms |
19192 KB |
Output is correct |
12 |
Correct |
19 ms |
19064 KB |
Output is correct |
13 |
Correct |
21 ms |
19064 KB |
Output is correct |
14 |
Correct |
20 ms |
19192 KB |
Output is correct |
15 |
Correct |
21 ms |
19192 KB |
Output is correct |
16 |
Correct |
21 ms |
19192 KB |
Output is correct |
17 |
Correct |
21 ms |
19068 KB |
Output is correct |
18 |
Correct |
21 ms |
19192 KB |
Output is correct |
19 |
Correct |
20 ms |
19064 KB |
Output is correct |
20 |
Correct |
20 ms |
19168 KB |
Output is correct |
21 |
Correct |
20 ms |
19192 KB |
Output is correct |
22 |
Correct |
21 ms |
19180 KB |
Output is correct |
23 |
Correct |
20 ms |
19192 KB |
Output is correct |
24 |
Correct |
20 ms |
19192 KB |
Output is correct |
25 |
Correct |
21 ms |
19192 KB |
Output is correct |
26 |
Correct |
21 ms |
19192 KB |
Output is correct |
27 |
Correct |
21 ms |
19064 KB |
Output is correct |
28 |
Correct |
23 ms |
19320 KB |
Output is correct |
29 |
Correct |
20 ms |
19192 KB |
Output is correct |
30 |
Correct |
21 ms |
19192 KB |
Output is correct |
31 |
Correct |
21 ms |
19192 KB |
Output is correct |
32 |
Correct |
21 ms |
19192 KB |
Output is correct |
33 |
Correct |
23 ms |
19320 KB |
Output is correct |
34 |
Correct |
23 ms |
19352 KB |
Output is correct |
35 |
Correct |
21 ms |
19320 KB |
Output is correct |
36 |
Correct |
22 ms |
19320 KB |
Output is correct |
37 |
Correct |
20 ms |
19192 KB |
Output is correct |
38 |
Correct |
36 ms |
20984 KB |
Output is correct |
39 |
Correct |
23 ms |
19448 KB |
Output is correct |
40 |
Correct |
23 ms |
19320 KB |
Output is correct |
41 |
Correct |
30 ms |
20088 KB |
Output is correct |
42 |
Correct |
28 ms |
19960 KB |
Output is correct |
43 |
Correct |
36 ms |
20856 KB |
Output is correct |
44 |
Correct |
36 ms |
20856 KB |
Output is correct |
45 |
Correct |
35 ms |
20856 KB |
Output is correct |
46 |
Correct |
35 ms |
20856 KB |
Output is correct |
47 |
Correct |
28 ms |
19960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
19960 KB |
Output is correct |
2 |
Correct |
30 ms |
20036 KB |
Output is correct |
3 |
Correct |
30 ms |
19960 KB |
Output is correct |
4 |
Correct |
26 ms |
19576 KB |
Output is correct |
5 |
Correct |
30 ms |
20088 KB |
Output is correct |
6 |
Correct |
30 ms |
19960 KB |
Output is correct |
7 |
Correct |
30 ms |
19960 KB |
Output is correct |
8 |
Correct |
28 ms |
19960 KB |
Output is correct |
9 |
Correct |
29 ms |
20088 KB |
Output is correct |
10 |
Correct |
29 ms |
20088 KB |
Output is correct |
11 |
Correct |
28 ms |
20088 KB |
Output is correct |
12 |
Correct |
29 ms |
19964 KB |
Output is correct |
13 |
Correct |
28 ms |
19932 KB |
Output is correct |
14 |
Correct |
23 ms |
19548 KB |
Output is correct |
15 |
Correct |
28 ms |
19960 KB |
Output is correct |
16 |
Correct |
29 ms |
19960 KB |
Output is correct |
17 |
Correct |
29 ms |
19960 KB |
Output is correct |
18 |
Correct |
28 ms |
19960 KB |
Output is correct |
19 |
Correct |
29 ms |
19960 KB |
Output is correct |
20 |
Correct |
24 ms |
19576 KB |
Output is correct |
21 |
Correct |
19 ms |
19192 KB |
Output is correct |
22 |
Correct |
20 ms |
19064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
19192 KB |
Output is correct |
2 |
Correct |
20 ms |
19192 KB |
Output is correct |
3 |
Correct |
26 ms |
19832 KB |
Output is correct |
4 |
Correct |
27 ms |
19704 KB |
Output is correct |
5 |
Correct |
26 ms |
19672 KB |
Output is correct |
6 |
Correct |
25 ms |
19704 KB |
Output is correct |
7 |
Correct |
22 ms |
19448 KB |
Output is correct |
8 |
Correct |
31 ms |
20344 KB |
Output is correct |
9 |
Correct |
31 ms |
20216 KB |
Output is correct |
10 |
Correct |
30 ms |
20216 KB |
Output is correct |
11 |
Correct |
30 ms |
20216 KB |
Output is correct |
12 |
Correct |
25 ms |
19704 KB |
Output is correct |
13 |
Correct |
29 ms |
19960 KB |
Output is correct |
14 |
Correct |
41 ms |
19960 KB |
Output is correct |
15 |
Correct |
27 ms |
19960 KB |
Output is correct |
16 |
Correct |
25 ms |
19448 KB |
Output is correct |
17 |
Correct |
28 ms |
19960 KB |
Output is correct |
18 |
Correct |
28 ms |
19960 KB |
Output is correct |
19 |
Correct |
24 ms |
19576 KB |
Output is correct |
20 |
Correct |
54 ms |
22780 KB |
Output is correct |
21 |
Correct |
89 ms |
22780 KB |
Output is correct |
22 |
Correct |
51 ms |
22648 KB |
Output is correct |
23 |
Correct |
33 ms |
20728 KB |
Output is correct |
24 |
Correct |
54 ms |
22776 KB |
Output is correct |
25 |
Correct |
53 ms |
22776 KB |
Output is correct |
26 |
Correct |
34 ms |
20856 KB |
Output is correct |
27 |
Correct |
79 ms |
25848 KB |
Output is correct |
28 |
Correct |
80 ms |
25844 KB |
Output is correct |
29 |
Correct |
84 ms |
25852 KB |
Output is correct |
30 |
Correct |
79 ms |
25848 KB |
Output is correct |
31 |
Correct |
53 ms |
22264 KB |
Output is correct |
32 |
Correct |
19 ms |
19192 KB |
Output is correct |
33 |
Correct |
20 ms |
19192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
25944 KB |
Output is correct |
2 |
Correct |
19 ms |
19192 KB |
Output is correct |
3 |
Correct |
25 ms |
19832 KB |
Output is correct |
4 |
Correct |
85 ms |
20344 KB |
Output is correct |
5 |
Correct |
28 ms |
20088 KB |
Output is correct |
6 |
Correct |
29 ms |
20088 KB |
Output is correct |
7 |
Correct |
55 ms |
22796 KB |
Output is correct |
8 |
Correct |
54 ms |
22840 KB |
Output is correct |
9 |
Correct |
81 ms |
25972 KB |
Output is correct |
10 |
Correct |
21 ms |
19192 KB |
Output is correct |
11 |
Correct |
21 ms |
19192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
19064 KB |
Output is correct |
2 |
Correct |
21 ms |
19192 KB |
Output is correct |
3 |
Correct |
21 ms |
19064 KB |
Output is correct |
4 |
Correct |
21 ms |
19064 KB |
Output is correct |
5 |
Correct |
20 ms |
19064 KB |
Output is correct |
6 |
Correct |
21 ms |
19064 KB |
Output is correct |
7 |
Correct |
20 ms |
19064 KB |
Output is correct |
8 |
Correct |
22 ms |
19064 KB |
Output is correct |
9 |
Correct |
22 ms |
19192 KB |
Output is correct |
10 |
Correct |
20 ms |
19192 KB |
Output is correct |
11 |
Correct |
21 ms |
19192 KB |
Output is correct |
12 |
Correct |
19 ms |
19064 KB |
Output is correct |
13 |
Correct |
21 ms |
19064 KB |
Output is correct |
14 |
Correct |
20 ms |
19192 KB |
Output is correct |
15 |
Correct |
21 ms |
19192 KB |
Output is correct |
16 |
Correct |
21 ms |
19192 KB |
Output is correct |
17 |
Correct |
21 ms |
19068 KB |
Output is correct |
18 |
Correct |
21 ms |
19192 KB |
Output is correct |
19 |
Correct |
20 ms |
19064 KB |
Output is correct |
20 |
Correct |
20 ms |
19168 KB |
Output is correct |
21 |
Correct |
20 ms |
19192 KB |
Output is correct |
22 |
Correct |
21 ms |
19180 KB |
Output is correct |
23 |
Correct |
20 ms |
19192 KB |
Output is correct |
24 |
Correct |
20 ms |
19192 KB |
Output is correct |
25 |
Correct |
21 ms |
19192 KB |
Output is correct |
26 |
Correct |
21 ms |
19192 KB |
Output is correct |
27 |
Correct |
21 ms |
19064 KB |
Output is correct |
28 |
Correct |
23 ms |
19320 KB |
Output is correct |
29 |
Correct |
20 ms |
19192 KB |
Output is correct |
30 |
Correct |
21 ms |
19192 KB |
Output is correct |
31 |
Correct |
21 ms |
19192 KB |
Output is correct |
32 |
Correct |
21 ms |
19192 KB |
Output is correct |
33 |
Correct |
23 ms |
19320 KB |
Output is correct |
34 |
Correct |
23 ms |
19352 KB |
Output is correct |
35 |
Correct |
21 ms |
19320 KB |
Output is correct |
36 |
Correct |
22 ms |
19320 KB |
Output is correct |
37 |
Correct |
20 ms |
19192 KB |
Output is correct |
38 |
Correct |
36 ms |
20984 KB |
Output is correct |
39 |
Correct |
23 ms |
19448 KB |
Output is correct |
40 |
Correct |
23 ms |
19320 KB |
Output is correct |
41 |
Correct |
30 ms |
20088 KB |
Output is correct |
42 |
Correct |
28 ms |
19960 KB |
Output is correct |
43 |
Correct |
36 ms |
20856 KB |
Output is correct |
44 |
Correct |
36 ms |
20856 KB |
Output is correct |
45 |
Correct |
35 ms |
20856 KB |
Output is correct |
46 |
Correct |
35 ms |
20856 KB |
Output is correct |
47 |
Correct |
28 ms |
19960 KB |
Output is correct |
48 |
Correct |
29 ms |
19960 KB |
Output is correct |
49 |
Correct |
30 ms |
20036 KB |
Output is correct |
50 |
Correct |
30 ms |
19960 KB |
Output is correct |
51 |
Correct |
26 ms |
19576 KB |
Output is correct |
52 |
Correct |
30 ms |
20088 KB |
Output is correct |
53 |
Correct |
30 ms |
19960 KB |
Output is correct |
54 |
Correct |
30 ms |
19960 KB |
Output is correct |
55 |
Correct |
28 ms |
19960 KB |
Output is correct |
56 |
Correct |
29 ms |
20088 KB |
Output is correct |
57 |
Correct |
29 ms |
20088 KB |
Output is correct |
58 |
Correct |
28 ms |
20088 KB |
Output is correct |
59 |
Correct |
29 ms |
19964 KB |
Output is correct |
60 |
Correct |
28 ms |
19932 KB |
Output is correct |
61 |
Correct |
23 ms |
19548 KB |
Output is correct |
62 |
Correct |
28 ms |
19960 KB |
Output is correct |
63 |
Correct |
29 ms |
19960 KB |
Output is correct |
64 |
Correct |
29 ms |
19960 KB |
Output is correct |
65 |
Correct |
28 ms |
19960 KB |
Output is correct |
66 |
Correct |
29 ms |
19960 KB |
Output is correct |
67 |
Correct |
24 ms |
19576 KB |
Output is correct |
68 |
Correct |
19 ms |
19192 KB |
Output is correct |
69 |
Correct |
20 ms |
19064 KB |
Output is correct |
70 |
Correct |
19 ms |
19192 KB |
Output is correct |
71 |
Correct |
20 ms |
19192 KB |
Output is correct |
72 |
Correct |
26 ms |
19832 KB |
Output is correct |
73 |
Correct |
27 ms |
19704 KB |
Output is correct |
74 |
Correct |
26 ms |
19672 KB |
Output is correct |
75 |
Correct |
25 ms |
19704 KB |
Output is correct |
76 |
Correct |
22 ms |
19448 KB |
Output is correct |
77 |
Correct |
31 ms |
20344 KB |
Output is correct |
78 |
Correct |
31 ms |
20216 KB |
Output is correct |
79 |
Correct |
30 ms |
20216 KB |
Output is correct |
80 |
Correct |
30 ms |
20216 KB |
Output is correct |
81 |
Correct |
25 ms |
19704 KB |
Output is correct |
82 |
Correct |
29 ms |
19960 KB |
Output is correct |
83 |
Correct |
41 ms |
19960 KB |
Output is correct |
84 |
Correct |
27 ms |
19960 KB |
Output is correct |
85 |
Correct |
25 ms |
19448 KB |
Output is correct |
86 |
Correct |
28 ms |
19960 KB |
Output is correct |
87 |
Correct |
28 ms |
19960 KB |
Output is correct |
88 |
Correct |
24 ms |
19576 KB |
Output is correct |
89 |
Correct |
54 ms |
22780 KB |
Output is correct |
90 |
Correct |
89 ms |
22780 KB |
Output is correct |
91 |
Correct |
51 ms |
22648 KB |
Output is correct |
92 |
Correct |
33 ms |
20728 KB |
Output is correct |
93 |
Correct |
54 ms |
22776 KB |
Output is correct |
94 |
Correct |
53 ms |
22776 KB |
Output is correct |
95 |
Correct |
34 ms |
20856 KB |
Output is correct |
96 |
Correct |
79 ms |
25848 KB |
Output is correct |
97 |
Correct |
80 ms |
25844 KB |
Output is correct |
98 |
Correct |
84 ms |
25852 KB |
Output is correct |
99 |
Correct |
79 ms |
25848 KB |
Output is correct |
100 |
Correct |
53 ms |
22264 KB |
Output is correct |
101 |
Correct |
19 ms |
19192 KB |
Output is correct |
102 |
Correct |
20 ms |
19192 KB |
Output is correct |
103 |
Correct |
80 ms |
25944 KB |
Output is correct |
104 |
Correct |
19 ms |
19192 KB |
Output is correct |
105 |
Correct |
25 ms |
19832 KB |
Output is correct |
106 |
Correct |
85 ms |
20344 KB |
Output is correct |
107 |
Correct |
28 ms |
20088 KB |
Output is correct |
108 |
Correct |
29 ms |
20088 KB |
Output is correct |
109 |
Correct |
55 ms |
22796 KB |
Output is correct |
110 |
Correct |
54 ms |
22840 KB |
Output is correct |
111 |
Correct |
81 ms |
25972 KB |
Output is correct |
112 |
Correct |
21 ms |
19192 KB |
Output is correct |
113 |
Correct |
21 ms |
19192 KB |
Output is correct |
114 |
Correct |
81 ms |
25972 KB |
Output is correct |
115 |
Correct |
30 ms |
19960 KB |
Output is correct |
116 |
Correct |
30 ms |
20088 KB |
Output is correct |
117 |
Correct |
52 ms |
22712 KB |
Output is correct |
118 |
Correct |
53 ms |
22772 KB |
Output is correct |
119 |
Correct |
81 ms |
25852 KB |
Output is correct |
120 |
Correct |
80 ms |
25848 KB |
Output is correct |
121 |
Correct |
80 ms |
25796 KB |
Output is correct |
122 |
Correct |
98 ms |
25816 KB |
Output is correct |
123 |
Correct |
81 ms |
25928 KB |
Output is correct |
124 |
Correct |
86 ms |
25848 KB |
Output is correct |
125 |
Correct |
79 ms |
25848 KB |
Output is correct |
126 |
Correct |
80 ms |
25888 KB |
Output is correct |
127 |
Correct |
81 ms |
25848 KB |
Output is correct |
128 |
Correct |
46 ms |
22096 KB |
Output is correct |