#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int h, w, k;
int cw;
int pnt(int x, int y)
{
return x + (y * w);
}
int has2(vi v)
{
return add_and({ add_or(v), add_not(add_xor(v)) });
} // 4 puertas
int hasmultiple(vi v)
{
int res = add_xor({ 0, 0 });
int prev = v[0];
for (int i = 1; i < v.size(); i++) {
res = add_or({ res, add_and({ prev, v[i] }) });
prev = add_or({ prev, v[i] });
}
return res;
}
void construct_network(int H, int W, int K)
{
h = H;
w = W;
k = K;
vi d1;
for (int d = -200; d < 200; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(i - j + d) <= k && i - j + d <= 0)
th.push_back(pnt(i, j));
if (th.size())
d1.push_back(has2(th));
}
vi d2;
for (int d = -200; d < 200; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(i + j + d) <= k && i + j + d <= 0)
th.push_back(pnt(i, j));
if (th.size())
d2.push_back(has2(th));
}
vi d3;
for (int d = -200; d < 200; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(i - j + d) <= k - 1 && i - j + d <= 0)
th.push_back(pnt(i, j));
if (th.size())
d3.push_back(has2(th));
}
vi d4;
for (int d = -200; d < 200; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(j + i + d) <= k - 1 && i + j + d <= 0)
th.push_back(pnt(i, j));
if (th.size())
d4.push_back(has2(th));
}
int tc = add_and({ add_or(d3), add_or(d4) });
int nf = add_and({ add_or(d1), add_or(d2) });
add_and({ nf, add_not(tc) });
}
Compilation message
vision.cpp: In function 'int hasmultiple(vi)':
vision.cpp:24:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for (int i = 1; i < v.size(); i++) {
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
300 KB |
Output is correct |
19 |
Correct |
1 ms |
292 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
296 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
300 KB |
Output is correct |
25 |
Correct |
2 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
424 KB |
Output is correct |
27 |
Correct |
2 ms |
428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
300 KB |
Output is correct |
19 |
Correct |
1 ms |
292 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
296 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
300 KB |
Output is correct |
25 |
Correct |
2 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
424 KB |
Output is correct |
27 |
Correct |
2 ms |
428 KB |
Output is correct |
28 |
Correct |
13 ms |
1196 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
368 KB |
Output is correct |
31 |
Correct |
15 ms |
1492 KB |
Output is correct |
32 |
Correct |
3 ms |
340 KB |
Output is correct |
33 |
Correct |
4 ms |
340 KB |
Output is correct |
34 |
Correct |
12 ms |
1236 KB |
Output is correct |
35 |
Correct |
21 ms |
1948 KB |
Output is correct |
36 |
Correct |
30 ms |
2872 KB |
Output is correct |
37 |
Correct |
37 ms |
3660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
300 KB |
Output is correct |
19 |
Correct |
1 ms |
292 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
296 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
300 KB |
Output is correct |
25 |
Correct |
2 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
424 KB |
Output is correct |
27 |
Correct |
2 ms |
428 KB |
Output is correct |
28 |
Correct |
13 ms |
1196 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
368 KB |
Output is correct |
31 |
Correct |
15 ms |
1492 KB |
Output is correct |
32 |
Correct |
3 ms |
340 KB |
Output is correct |
33 |
Correct |
4 ms |
340 KB |
Output is correct |
34 |
Correct |
12 ms |
1236 KB |
Output is correct |
35 |
Correct |
21 ms |
1948 KB |
Output is correct |
36 |
Correct |
30 ms |
2872 KB |
Output is correct |
37 |
Correct |
37 ms |
3660 KB |
Output is correct |
38 |
Incorrect |
7 ms |
4388 KB |
WA in grader: Too many inputs |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
468 KB |
Output is correct |
2 |
Correct |
13 ms |
1372 KB |
Output is correct |
3 |
Correct |
12 ms |
1364 KB |
Output is correct |
4 |
Correct |
17 ms |
1704 KB |
Output is correct |
5 |
Correct |
3 ms |
468 KB |
Output is correct |
6 |
Correct |
10 ms |
1196 KB |
Output is correct |
7 |
Correct |
19 ms |
1892 KB |
Output is correct |
8 |
Correct |
23 ms |
2404 KB |
Output is correct |
9 |
Correct |
3 ms |
468 KB |
Output is correct |
10 |
Correct |
9 ms |
956 KB |
Output is correct |
11 |
Correct |
12 ms |
1348 KB |
Output is correct |
12 |
Correct |
15 ms |
1340 KB |
Output is correct |
13 |
Correct |
15 ms |
1620 KB |
Output is correct |
14 |
Correct |
18 ms |
1620 KB |
Output is correct |
15 |
Correct |
2 ms |
580 KB |
Output is correct |
16 |
Correct |
9 ms |
1056 KB |
Output is correct |
17 |
Correct |
14 ms |
1620 KB |
Output is correct |
18 |
Correct |
18 ms |
1612 KB |
Output is correct |
19 |
Correct |
19 ms |
2000 KB |
Output is correct |
20 |
Correct |
32 ms |
2376 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
9 ms |
744 KB |
Output is correct |
4 |
Correct |
70 ms |
6728 KB |
Output is correct |
5 |
Incorrect |
8 ms |
4780 KB |
WA in grader: Too many inputs |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
113 ms |
4136 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
300 KB |
Output is correct |
19 |
Correct |
1 ms |
292 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
296 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
300 KB |
Output is correct |
25 |
Correct |
2 ms |
340 KB |
Output is correct |
26 |
Correct |
2 ms |
424 KB |
Output is correct |
27 |
Correct |
2 ms |
428 KB |
Output is correct |
28 |
Correct |
13 ms |
1196 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
368 KB |
Output is correct |
31 |
Correct |
15 ms |
1492 KB |
Output is correct |
32 |
Correct |
3 ms |
340 KB |
Output is correct |
33 |
Correct |
4 ms |
340 KB |
Output is correct |
34 |
Correct |
12 ms |
1236 KB |
Output is correct |
35 |
Correct |
21 ms |
1948 KB |
Output is correct |
36 |
Correct |
30 ms |
2872 KB |
Output is correct |
37 |
Correct |
37 ms |
3660 KB |
Output is correct |
38 |
Incorrect |
7 ms |
4388 KB |
WA in grader: Too many inputs |
39 |
Halted |
0 ms |
0 KB |
- |