답안 #725170

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
725170 2023-04-17T02:32:42 Z QwertyPi Vision Program (IOI19_vision) C++14
100 / 100
83 ms 8148 KB
#include "vision.h"

int H, W, K;
int id(int x, int y){
	return x * W + y;
}
int solve(int a[201], int b[201]){
	std::vector<int> v1;
	for(int i = 0; i <= (H + W - 2) - K; i++){
		v1.push_back(add_and({a[i], a[i + K]}));
	}
	int a1 = add_or(v1);

	std::vector<int> v2;
	for(int i = 0; i <= H + W - 2; i++){
		std::vector<int> v;
		for(int j = std::max(0, i - K); j <= std::min(H + W - 2, i + K); j++){
			if(j != i) v.push_back(b[j]);
		}
		v2.push_back(add_and({b[i], add_or(v)}));
		v.clear();
		for(int j = 0; j <= H + W - 2; j++){
			if(j != i) v.push_back(b[j]);
		}
		v2.push_back(add_and({b[i], add_not(add_or(v))}));

	}
	int a2 = add_or(v2);

	return add_and({a1, a2});
}

void construct_network(int H, int W, int K) {
	::H = H, ::W = W, ::K = K;
	int a[H + W - 1], b[H + W - 1];
	std::vector<int> va[H + W - 1], vb[H + W - 1];
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			va[i + j].push_back(id(i, j));
			vb[i + (W - 1 - j)].push_back(id(i, j));
		}
	}
	for(int i = 0; i <= H + W - 2; i++) a[i] = add_or(va[i]);
	for(int i = 0; i <= H + W - 2; i++) b[i] = add_or(vb[i]);
	int a1 = solve(a, b), a2 = solve(b, a);
	add_or({a1, a2});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 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 0 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 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 284 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 280 KB Output is correct
18 Correct 1 ms 280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 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 0 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 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 284 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 280 KB Output is correct
18 Correct 1 ms 280 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 284 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 292 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 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 0 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 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 284 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 280 KB Output is correct
18 Correct 1 ms 280 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 284 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 292 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 1 ms 284 KB Output is correct
30 Correct 1 ms 284 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 2 ms 420 KB Output is correct
36 Correct 3 ms 416 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 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 0 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 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 284 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 280 KB Output is correct
18 Correct 1 ms 280 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 284 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 292 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 1 ms 284 KB Output is correct
30 Correct 1 ms 284 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 2 ms 420 KB Output is correct
36 Correct 3 ms 416 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 15 ms 1876 KB Output is correct
39 Correct 4 ms 596 KB Output is correct
40 Correct 5 ms 596 KB Output is correct
41 Correct 7 ms 980 KB Output is correct
42 Correct 12 ms 1236 KB Output is correct
43 Correct 13 ms 1568 KB Output is correct
44 Correct 15 ms 1876 KB Output is correct
45 Correct 16 ms 2132 KB Output is correct
46 Correct 18 ms 2176 KB Output is correct
47 Correct 19 ms 2260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1108 KB Output is correct
2 Correct 15 ms 1500 KB Output is correct
3 Correct 21 ms 1492 KB Output is correct
4 Correct 16 ms 1616 KB Output is correct
5 Correct 9 ms 1108 KB Output is correct
6 Correct 17 ms 1468 KB Output is correct
7 Correct 15 ms 1620 KB Output is correct
8 Correct 17 ms 1676 KB Output is correct
9 Correct 14 ms 1108 KB Output is correct
10 Correct 12 ms 1364 KB Output is correct
11 Correct 16 ms 1620 KB Output is correct
12 Correct 14 ms 1572 KB Output is correct
13 Correct 17 ms 1620 KB Output is correct
14 Correct 16 ms 1628 KB Output is correct
15 Correct 8 ms 1108 KB Output is correct
16 Correct 13 ms 1392 KB Output is correct
17 Correct 15 ms 1616 KB Output is correct
18 Correct 15 ms 1596 KB Output is correct
19 Correct 18 ms 1620 KB Output is correct
20 Correct 19 ms 1748 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 5 ms 760 KB Output is correct
4 Correct 7 ms 852 KB Output is correct
5 Correct 7 ms 980 KB Output is correct
6 Correct 7 ms 980 KB Output is correct
7 Correct 10 ms 1048 KB Output is correct
8 Correct 10 ms 1108 KB Output is correct
9 Correct 11 ms 1364 KB Output is correct
10 Correct 14 ms 1596 KB Output is correct
11 Correct 19 ms 1620 KB Output is correct
12 Correct 15 ms 1748 KB Output is correct
13 Correct 10 ms 1032 KB Output is correct
14 Correct 12 ms 1412 KB Output is correct
15 Correct 15 ms 1596 KB Output is correct
16 Correct 15 ms 1716 KB Output is correct
17 Correct 8 ms 1120 KB Output is correct
18 Correct 17 ms 1488 KB Output is correct
19 Correct 17 ms 1620 KB Output is correct
20 Correct 23 ms 2896 KB Output is correct
21 Correct 31 ms 3900 KB Output is correct
22 Correct 36 ms 4500 KB Output is correct
23 Correct 38 ms 4668 KB Output is correct
24 Correct 31 ms 2912 KB Output is correct
25 Correct 34 ms 4304 KB Output is correct
26 Correct 39 ms 4600 KB Output is correct
27 Correct 40 ms 5064 KB Output is correct
28 Correct 59 ms 6456 KB Output is correct
29 Correct 61 ms 7500 KB Output is correct
30 Correct 69 ms 7952 KB Output is correct
31 Correct 79 ms 8136 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 5080 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 7 ms 724 KB Output is correct
4 Correct 9 ms 1108 KB Output is correct
5 Correct 10 ms 1108 KB Output is correct
6 Correct 8 ms 1148 KB Output is correct
7 Correct 24 ms 2932 KB Output is correct
8 Correct 23 ms 3056 KB Output is correct
9 Correct 43 ms 5076 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 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 0 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 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 284 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 280 KB Output is correct
18 Correct 1 ms 280 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 284 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 292 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 1 ms 284 KB Output is correct
30 Correct 1 ms 284 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 2 ms 420 KB Output is correct
36 Correct 3 ms 416 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 15 ms 1876 KB Output is correct
39 Correct 4 ms 596 KB Output is correct
40 Correct 5 ms 596 KB Output is correct
41 Correct 7 ms 980 KB Output is correct
42 Correct 12 ms 1236 KB Output is correct
43 Correct 13 ms 1568 KB Output is correct
44 Correct 15 ms 1876 KB Output is correct
45 Correct 16 ms 2132 KB Output is correct
46 Correct 18 ms 2176 KB Output is correct
47 Correct 19 ms 2260 KB Output is correct
48 Correct 9 ms 1108 KB Output is correct
49 Correct 15 ms 1500 KB Output is correct
50 Correct 21 ms 1492 KB Output is correct
51 Correct 16 ms 1616 KB Output is correct
52 Correct 9 ms 1108 KB Output is correct
53 Correct 17 ms 1468 KB Output is correct
54 Correct 15 ms 1620 KB Output is correct
55 Correct 17 ms 1676 KB Output is correct
56 Correct 14 ms 1108 KB Output is correct
57 Correct 12 ms 1364 KB Output is correct
58 Correct 16 ms 1620 KB Output is correct
59 Correct 14 ms 1572 KB Output is correct
60 Correct 17 ms 1620 KB Output is correct
61 Correct 16 ms 1628 KB Output is correct
62 Correct 8 ms 1108 KB Output is correct
63 Correct 13 ms 1392 KB Output is correct
64 Correct 15 ms 1616 KB Output is correct
65 Correct 15 ms 1596 KB Output is correct
66 Correct 18 ms 1620 KB Output is correct
67 Correct 19 ms 1748 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 5 ms 760 KB Output is correct
73 Correct 7 ms 852 KB Output is correct
74 Correct 7 ms 980 KB Output is correct
75 Correct 7 ms 980 KB Output is correct
76 Correct 10 ms 1048 KB Output is correct
77 Correct 10 ms 1108 KB Output is correct
78 Correct 11 ms 1364 KB Output is correct
79 Correct 14 ms 1596 KB Output is correct
80 Correct 19 ms 1620 KB Output is correct
81 Correct 15 ms 1748 KB Output is correct
82 Correct 10 ms 1032 KB Output is correct
83 Correct 12 ms 1412 KB Output is correct
84 Correct 15 ms 1596 KB Output is correct
85 Correct 15 ms 1716 KB Output is correct
86 Correct 8 ms 1120 KB Output is correct
87 Correct 17 ms 1488 KB Output is correct
88 Correct 17 ms 1620 KB Output is correct
89 Correct 23 ms 2896 KB Output is correct
90 Correct 31 ms 3900 KB Output is correct
91 Correct 36 ms 4500 KB Output is correct
92 Correct 38 ms 4668 KB Output is correct
93 Correct 31 ms 2912 KB Output is correct
94 Correct 34 ms 4304 KB Output is correct
95 Correct 39 ms 4600 KB Output is correct
96 Correct 40 ms 5064 KB Output is correct
97 Correct 59 ms 6456 KB Output is correct
98 Correct 61 ms 7500 KB Output is correct
99 Correct 69 ms 7952 KB Output is correct
100 Correct 79 ms 8136 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 41 ms 5080 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 7 ms 724 KB Output is correct
106 Correct 9 ms 1108 KB Output is correct
107 Correct 10 ms 1108 KB Output is correct
108 Correct 8 ms 1148 KB Output is correct
109 Correct 24 ms 2932 KB Output is correct
110 Correct 23 ms 3056 KB Output is correct
111 Correct 43 ms 5076 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 52 ms 6564 KB Output is correct
115 Correct 18 ms 1636 KB Output is correct
116 Correct 10 ms 1108 KB Output is correct
117 Correct 53 ms 4556 KB Output is correct
118 Correct 28 ms 3440 KB Output is correct
119 Correct 63 ms 7476 KB Output is correct
120 Correct 74 ms 7496 KB Output is correct
121 Correct 65 ms 7480 KB Output is correct
122 Correct 63 ms 7580 KB Output is correct
123 Correct 45 ms 5068 KB Output is correct
124 Correct 56 ms 6492 KB Output is correct
125 Correct 68 ms 7580 KB Output is correct
126 Correct 83 ms 7472 KB Output is correct
127 Correct 65 ms 8008 KB Output is correct
128 Correct 70 ms 8148 KB Output is correct