#include "vision.h"
using namespace std;
typedef vector<int> vi;
const int N = 200, M = 200;
int close(int *aa, int n, int k) {
vi uu;
int i, j, yes;
uu.resize(2);
yes = -1;
for (i = 0; i < n; i++)
if (yes == -1)
yes = aa[i];
else
uu[0] = yes, uu[1] = aa[i], yes = add_xor(uu);
if (k > 0)
for (i = 0; i + 1 < n; i++) {
int yes_;
uu.resize(0);
for (j = i + 1; j <= i + k && j < n; j++)
uu.push_back(aa[j]);
yes_ = add_or(uu);
uu.resize(2);
uu[0] = yes_, uu[1] = aa[i], yes_ = add_and(uu);
uu[0] = yes, uu[1] = yes_, yes = add_or(uu);
}
return yes;
}
int aa[N + M], bb[N + M];
void construct_network(int n, int m, int k) {
int x, y, i, j, not_too_far, not_too_close, yes;
vi uu;
for (x = 0; x <= (n - 1) + (m - 1); x++) {
uu.resize(0);
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
if (i + j == x)
uu.push_back(i * m + j);
aa[x] = add_or(uu);
}
for (y = 0; y <= (n - 1) + (m - 1); y++) {
uu.resize(0);
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
if (i - j + m - 1 == y)
uu.push_back(i * m + j);
bb[y] = add_or(uu);
}
uu.resize(2);
uu[0] = close(aa, n + m - 1, k), uu[1] = close(bb, n + m - 1, k), not_too_far = add_and(uu);
uu[0] = close(aa, n + m - 1, k - 1), uu[1] = close(bb, n + m - 1, k - 1), not_too_close = add_not(add_and(uu));
uu[0] = not_too_far, uu[1] = not_too_close;
yes = add_and(uu);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:38:46: warning: variable 'yes' set but not used [-Wunused-but-set-variable]
38 | int x, y, i, j, not_too_far, not_too_close, yes;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
284 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
284 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
288 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
284 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
288 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
204 KB |
Output is correct |
30 |
Correct |
1 ms |
204 KB |
Output is correct |
31 |
Correct |
1 ms |
332 KB |
Output is correct |
32 |
Correct |
1 ms |
280 KB |
Output is correct |
33 |
Correct |
1 ms |
284 KB |
Output is correct |
34 |
Correct |
2 ms |
332 KB |
Output is correct |
35 |
Correct |
2 ms |
332 KB |
Output is correct |
36 |
Correct |
2 ms |
332 KB |
Output is correct |
37 |
Correct |
2 ms |
408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
284 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
288 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
204 KB |
Output is correct |
30 |
Correct |
1 ms |
204 KB |
Output is correct |
31 |
Correct |
1 ms |
332 KB |
Output is correct |
32 |
Correct |
1 ms |
280 KB |
Output is correct |
33 |
Correct |
1 ms |
284 KB |
Output is correct |
34 |
Correct |
2 ms |
332 KB |
Output is correct |
35 |
Correct |
2 ms |
332 KB |
Output is correct |
36 |
Correct |
2 ms |
332 KB |
Output is correct |
37 |
Correct |
2 ms |
408 KB |
Output is correct |
38 |
Correct |
11 ms |
972 KB |
Output is correct |
39 |
Correct |
2 ms |
460 KB |
Output is correct |
40 |
Correct |
3 ms |
460 KB |
Output is correct |
41 |
Correct |
4 ms |
588 KB |
Output is correct |
42 |
Correct |
9 ms |
892 KB |
Output is correct |
43 |
Correct |
7 ms |
588 KB |
Output is correct |
44 |
Correct |
11 ms |
1036 KB |
Output is correct |
45 |
Correct |
14 ms |
1300 KB |
Output is correct |
46 |
Correct |
15 ms |
1356 KB |
Output is correct |
47 |
Correct |
16 ms |
1448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
2 |
Correct |
8 ms |
920 KB |
Output is correct |
3 |
Correct |
9 ms |
972 KB |
Output is correct |
4 |
Correct |
12 ms |
1100 KB |
Output is correct |
5 |
Correct |
2 ms |
460 KB |
Output is correct |
6 |
Correct |
7 ms |
844 KB |
Output is correct |
7 |
Correct |
10 ms |
1100 KB |
Output is correct |
8 |
Correct |
11 ms |
1140 KB |
Output is correct |
9 |
Correct |
2 ms |
460 KB |
Output is correct |
10 |
Correct |
6 ms |
716 KB |
Output is correct |
11 |
Correct |
8 ms |
972 KB |
Output is correct |
12 |
Correct |
9 ms |
928 KB |
Output is correct |
13 |
Correct |
10 ms |
1052 KB |
Output is correct |
14 |
Correct |
10 ms |
1100 KB |
Output is correct |
15 |
Correct |
2 ms |
460 KB |
Output is correct |
16 |
Correct |
6 ms |
716 KB |
Output is correct |
17 |
Correct |
8 ms |
972 KB |
Output is correct |
18 |
Correct |
9 ms |
972 KB |
Output is correct |
19 |
Correct |
10 ms |
1100 KB |
Output is correct |
20 |
Correct |
11 ms |
1100 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
588 KB |
Output is correct |
5 |
Correct |
6 ms |
732 KB |
Output is correct |
6 |
Correct |
6 ms |
844 KB |
Output is correct |
7 |
Correct |
6 ms |
796 KB |
Output is correct |
8 |
Correct |
4 ms |
588 KB |
Output is correct |
9 |
Correct |
8 ms |
832 KB |
Output is correct |
10 |
Correct |
10 ms |
972 KB |
Output is correct |
11 |
Correct |
11 ms |
1116 KB |
Output is correct |
12 |
Correct |
16 ms |
1100 KB |
Output is correct |
13 |
Correct |
2 ms |
460 KB |
Output is correct |
14 |
Correct |
6 ms |
844 KB |
Output is correct |
15 |
Correct |
10 ms |
1064 KB |
Output is correct |
16 |
Correct |
11 ms |
1100 KB |
Output is correct |
17 |
Correct |
2 ms |
460 KB |
Output is correct |
18 |
Correct |
11 ms |
972 KB |
Output is correct |
19 |
Correct |
10 ms |
1180 KB |
Output is correct |
20 |
Correct |
15 ms |
944 KB |
Output is correct |
21 |
Correct |
27 ms |
1960 KB |
Output is correct |
22 |
Correct |
34 ms |
2496 KB |
Output is correct |
23 |
Correct |
35 ms |
2760 KB |
Output is correct |
24 |
Correct |
16 ms |
944 KB |
Output is correct |
25 |
Correct |
33 ms |
2304 KB |
Output is correct |
26 |
Correct |
37 ms |
2708 KB |
Output is correct |
27 |
Correct |
31 ms |
1344 KB |
Output is correct |
28 |
Correct |
48 ms |
2832 KB |
Output is correct |
29 |
Correct |
59 ms |
3908 KB |
Output is correct |
30 |
Correct |
65 ms |
4460 KB |
Output is correct |
31 |
Correct |
67 ms |
4672 KB |
Output is correct |
32 |
Correct |
0 ms |
284 KB |
Output is correct |
33 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
1412 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
588 KB |
Output is correct |
5 |
Correct |
2 ms |
460 KB |
Output is correct |
6 |
Correct |
2 ms |
460 KB |
Output is correct |
7 |
Correct |
15 ms |
844 KB |
Output is correct |
8 |
Correct |
15 ms |
844 KB |
Output is correct |
9 |
Correct |
31 ms |
1340 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
284 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1 ms |
204 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
288 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
204 KB |
Output is correct |
30 |
Correct |
1 ms |
204 KB |
Output is correct |
31 |
Correct |
1 ms |
332 KB |
Output is correct |
32 |
Correct |
1 ms |
280 KB |
Output is correct |
33 |
Correct |
1 ms |
284 KB |
Output is correct |
34 |
Correct |
2 ms |
332 KB |
Output is correct |
35 |
Correct |
2 ms |
332 KB |
Output is correct |
36 |
Correct |
2 ms |
332 KB |
Output is correct |
37 |
Correct |
2 ms |
408 KB |
Output is correct |
38 |
Correct |
11 ms |
972 KB |
Output is correct |
39 |
Correct |
2 ms |
460 KB |
Output is correct |
40 |
Correct |
3 ms |
460 KB |
Output is correct |
41 |
Correct |
4 ms |
588 KB |
Output is correct |
42 |
Correct |
9 ms |
892 KB |
Output is correct |
43 |
Correct |
7 ms |
588 KB |
Output is correct |
44 |
Correct |
11 ms |
1036 KB |
Output is correct |
45 |
Correct |
14 ms |
1300 KB |
Output is correct |
46 |
Correct |
15 ms |
1356 KB |
Output is correct |
47 |
Correct |
16 ms |
1448 KB |
Output is correct |
48 |
Correct |
2 ms |
460 KB |
Output is correct |
49 |
Correct |
8 ms |
920 KB |
Output is correct |
50 |
Correct |
9 ms |
972 KB |
Output is correct |
51 |
Correct |
12 ms |
1100 KB |
Output is correct |
52 |
Correct |
2 ms |
460 KB |
Output is correct |
53 |
Correct |
7 ms |
844 KB |
Output is correct |
54 |
Correct |
10 ms |
1100 KB |
Output is correct |
55 |
Correct |
11 ms |
1140 KB |
Output is correct |
56 |
Correct |
2 ms |
460 KB |
Output is correct |
57 |
Correct |
6 ms |
716 KB |
Output is correct |
58 |
Correct |
8 ms |
972 KB |
Output is correct |
59 |
Correct |
9 ms |
928 KB |
Output is correct |
60 |
Correct |
10 ms |
1052 KB |
Output is correct |
61 |
Correct |
10 ms |
1100 KB |
Output is correct |
62 |
Correct |
2 ms |
460 KB |
Output is correct |
63 |
Correct |
6 ms |
716 KB |
Output is correct |
64 |
Correct |
8 ms |
972 KB |
Output is correct |
65 |
Correct |
9 ms |
972 KB |
Output is correct |
66 |
Correct |
10 ms |
1100 KB |
Output is correct |
67 |
Correct |
11 ms |
1100 KB |
Output is correct |
68 |
Correct |
0 ms |
204 KB |
Output is correct |
69 |
Correct |
0 ms |
284 KB |
Output is correct |
70 |
Correct |
0 ms |
204 KB |
Output is correct |
71 |
Correct |
1 ms |
204 KB |
Output is correct |
72 |
Correct |
3 ms |
460 KB |
Output is correct |
73 |
Correct |
4 ms |
588 KB |
Output is correct |
74 |
Correct |
6 ms |
732 KB |
Output is correct |
75 |
Correct |
6 ms |
844 KB |
Output is correct |
76 |
Correct |
6 ms |
796 KB |
Output is correct |
77 |
Correct |
4 ms |
588 KB |
Output is correct |
78 |
Correct |
8 ms |
832 KB |
Output is correct |
79 |
Correct |
10 ms |
972 KB |
Output is correct |
80 |
Correct |
11 ms |
1116 KB |
Output is correct |
81 |
Correct |
16 ms |
1100 KB |
Output is correct |
82 |
Correct |
2 ms |
460 KB |
Output is correct |
83 |
Correct |
6 ms |
844 KB |
Output is correct |
84 |
Correct |
10 ms |
1064 KB |
Output is correct |
85 |
Correct |
11 ms |
1100 KB |
Output is correct |
86 |
Correct |
2 ms |
460 KB |
Output is correct |
87 |
Correct |
11 ms |
972 KB |
Output is correct |
88 |
Correct |
10 ms |
1180 KB |
Output is correct |
89 |
Correct |
15 ms |
944 KB |
Output is correct |
90 |
Correct |
27 ms |
1960 KB |
Output is correct |
91 |
Correct |
34 ms |
2496 KB |
Output is correct |
92 |
Correct |
35 ms |
2760 KB |
Output is correct |
93 |
Correct |
16 ms |
944 KB |
Output is correct |
94 |
Correct |
33 ms |
2304 KB |
Output is correct |
95 |
Correct |
37 ms |
2708 KB |
Output is correct |
96 |
Correct |
31 ms |
1344 KB |
Output is correct |
97 |
Correct |
48 ms |
2832 KB |
Output is correct |
98 |
Correct |
59 ms |
3908 KB |
Output is correct |
99 |
Correct |
65 ms |
4460 KB |
Output is correct |
100 |
Correct |
67 ms |
4672 KB |
Output is correct |
101 |
Correct |
0 ms |
284 KB |
Output is correct |
102 |
Correct |
0 ms |
204 KB |
Output is correct |
103 |
Correct |
31 ms |
1412 KB |
Output is correct |
104 |
Correct |
1 ms |
204 KB |
Output is correct |
105 |
Correct |
3 ms |
460 KB |
Output is correct |
106 |
Correct |
4 ms |
588 KB |
Output is correct |
107 |
Correct |
2 ms |
460 KB |
Output is correct |
108 |
Correct |
2 ms |
460 KB |
Output is correct |
109 |
Correct |
15 ms |
844 KB |
Output is correct |
110 |
Correct |
15 ms |
844 KB |
Output is correct |
111 |
Correct |
31 ms |
1340 KB |
Output is correct |
112 |
Correct |
0 ms |
204 KB |
Output is correct |
113 |
Correct |
0 ms |
284 KB |
Output is correct |
114 |
Correct |
48 ms |
2880 KB |
Output is correct |
115 |
Correct |
11 ms |
1116 KB |
Output is correct |
116 |
Correct |
2 ms |
460 KB |
Output is correct |
117 |
Correct |
35 ms |
2696 KB |
Output is correct |
118 |
Correct |
21 ms |
1480 KB |
Output is correct |
119 |
Correct |
57 ms |
3876 KB |
Output is correct |
120 |
Correct |
58 ms |
3864 KB |
Output is correct |
121 |
Correct |
58 ms |
3836 KB |
Output is correct |
122 |
Correct |
60 ms |
3804 KB |
Output is correct |
123 |
Correct |
31 ms |
1352 KB |
Output is correct |
124 |
Correct |
50 ms |
2880 KB |
Output is correct |
125 |
Correct |
63 ms |
3904 KB |
Output is correct |
126 |
Correct |
58 ms |
3940 KB |
Output is correct |
127 |
Correct |
75 ms |
4500 KB |
Output is correct |
128 |
Correct |
73 ms |
4620 KB |
Output is correct |