답안 #591062

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
591062 2022-07-06T19:26:29 Z Soumya1 Vision Program (IOI19_vision) C++17
100 / 100
59 ms 5320 KB
#include "vision.h"
#include <bits/stdc++.h>
#ifdef __LOCAL__
	#include <debug_local.h>
#endif
using namespace std;
void construct_network(int H, int W, int K) {
	vector<int> posleft(H + W), posxorleft(H + W);
	for (int diag = 0; diag <= H + W - 2; diag++) {
		vector<int> v;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (i + j == diag) {
					v.push_back(i * W + j);
				}
			}
		}
		posleft[diag] = add_or(v);
		posxorleft[diag] = add_xor(v);
	}
	vector<int> posright(H + W), posxorright(H + W);
	for (int diag = 0; diag <= H + W - 2; diag++) {
		vector<int> v;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (j - i + H - 1 == diag) {
					v.push_back(i * W + j);
				}
			}
		}
		posright[diag] = add_or(v);
		posxorright[diag] = add_xor(v);
	}
	vector<int> hastwoleft(H + W);
	for (int diag = 0; diag <= H + W - 2; diag++) {
		vector<int> v1, v2;
		for (int d = diag; d <= min(H + W - 2, diag + K); d++) {
			v1.push_back(posleft[d]);
			v2.push_back(posxorleft[d]);
		}
		int orr = add_or(v1);
		int xorr = add_xor(v2);
		hastwoleft[diag] = add_and({orr, add_not(xorr)});
	}
	vector<int> hastworight(H + W);
	for (int diag = 0; diag <= H + W - 2; diag++) {
		vector<int> v1, v2;
		for (int d = diag; d <= min(H + W - 2, diag + K); d++) {
			v1.push_back(posright[d]);
			v2.push_back(posxorright[d]);
		}
		int orr = add_or(v1);
		int xorr = add_xor(v2);
		hastworight[diag] = add_and({orr, add_not(xorr)});
	}
	vector<int> twodiagleft(H + W);
	for (int diag = 0; diag <= H + W - 2 - K; diag++) {
		twodiagleft[diag] = add_and({posleft[diag], posleft[diag + K]});
	}
	vector<int> twodiagright(H + W);
	for (int diag = 0; diag <= H + W - 2 - K; diag++) {
		twodiagright[diag] = add_and({posright[diag], posright[diag + K]});
	}
	int first;
	{
		vector<int> v;
		for (int diag = 0; diag <= H + W - 2 - K; diag++) {
			v.push_back(twodiagleft[diag]);
		}
		int f1 = add_or(v);
		v.clear();
		for (int diag = 0; diag <= H + W - 2; diag++) {
			v.push_back(hastworight[diag]);
		}
		int f2 = add_or(v);
		first = add_and({f1, f2});
	}
	int second;
	{
		vector<int> v;
		for (int diag = 0; diag <= H + W - 2 - K; diag++) {
			v.push_back(twodiagright[diag]);
		}
		int f1 = add_or(v);
		v.clear();
		for (int diag = 0; diag <= H + W - 2; diag++) {
			v.push_back(hastwoleft[diag]);
		}
		int f2 = add_or(v);
		second = add_and({f1, f2});
	}
	add_or({first, second});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 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 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 232 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 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 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 232 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 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 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 232 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 10 ms 1116 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 10 ms 980 KB Output is correct
43 Correct 10 ms 884 KB Output is correct
44 Correct 11 ms 1108 KB Output is correct
45 Correct 12 ms 1408 KB Output is correct
46 Correct 13 ms 1480 KB Output is correct
47 Correct 14 ms 1588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 6 ms 980 KB Output is correct
3 Correct 6 ms 980 KB Output is correct
4 Correct 8 ms 1108 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 5 ms 852 KB Output is correct
7 Correct 10 ms 980 KB Output is correct
8 Correct 8 ms 1076 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 5 ms 724 KB Output is correct
11 Correct 7 ms 980 KB Output is correct
12 Correct 6 ms 980 KB Output is correct
13 Correct 8 ms 1108 KB Output is correct
14 Correct 8 ms 1100 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 4 ms 724 KB Output is correct
17 Correct 7 ms 968 KB Output is correct
18 Correct 9 ms 900 KB Output is correct
19 Correct 8 ms 1100 KB Output is correct
20 Correct 8 ms 1108 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 0 ms 212 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 4 ms 596 KB Output is correct
5 Correct 5 ms 724 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 5 ms 724 KB Output is correct
8 Correct 8 ms 724 KB Output is correct
9 Correct 8 ms 852 KB Output is correct
10 Correct 9 ms 1108 KB Output is correct
11 Correct 11 ms 1236 KB Output is correct
12 Correct 10 ms 1236 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 7 ms 724 KB Output is correct
15 Correct 7 ms 980 KB Output is correct
16 Correct 8 ms 1108 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 6 ms 980 KB Output is correct
19 Correct 9 ms 1136 KB Output is correct
20 Correct 16 ms 1356 KB Output is correct
21 Correct 24 ms 2260 KB Output is correct
22 Correct 28 ms 2916 KB Output is correct
23 Correct 33 ms 3036 KB Output is correct
24 Correct 18 ms 1352 KB Output is correct
25 Correct 26 ms 2536 KB Output is correct
26 Correct 30 ms 3016 KB Output is correct
27 Correct 31 ms 2224 KB Output is correct
28 Correct 43 ms 3528 KB Output is correct
29 Correct 51 ms 4476 KB Output is correct
30 Correct 59 ms 5160 KB Output is correct
31 Correct 59 ms 5268 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 2252 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 5 ms 724 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 16 ms 1348 KB Output is correct
8 Correct 15 ms 1288 KB Output is correct
9 Correct 31 ms 2204 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 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 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 232 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 10 ms 1116 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 10 ms 980 KB Output is correct
43 Correct 10 ms 884 KB Output is correct
44 Correct 11 ms 1108 KB Output is correct
45 Correct 12 ms 1408 KB Output is correct
46 Correct 13 ms 1480 KB Output is correct
47 Correct 14 ms 1588 KB Output is correct
48 Correct 2 ms 468 KB Output is correct
49 Correct 6 ms 980 KB Output is correct
50 Correct 6 ms 980 KB Output is correct
51 Correct 8 ms 1108 KB Output is correct
52 Correct 2 ms 544 KB Output is correct
53 Correct 5 ms 852 KB Output is correct
54 Correct 10 ms 980 KB Output is correct
55 Correct 8 ms 1076 KB Output is correct
56 Correct 2 ms 468 KB Output is correct
57 Correct 5 ms 724 KB Output is correct
58 Correct 7 ms 980 KB Output is correct
59 Correct 6 ms 980 KB Output is correct
60 Correct 8 ms 1108 KB Output is correct
61 Correct 8 ms 1100 KB Output is correct
62 Correct 2 ms 468 KB Output is correct
63 Correct 4 ms 724 KB Output is correct
64 Correct 7 ms 968 KB Output is correct
65 Correct 9 ms 900 KB Output is correct
66 Correct 8 ms 1100 KB Output is correct
67 Correct 8 ms 1108 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 0 ms 212 KB Output is correct
72 Correct 3 ms 468 KB Output is correct
73 Correct 4 ms 596 KB Output is correct
74 Correct 5 ms 724 KB Output is correct
75 Correct 5 ms 724 KB Output is correct
76 Correct 5 ms 724 KB Output is correct
77 Correct 8 ms 724 KB Output is correct
78 Correct 8 ms 852 KB Output is correct
79 Correct 9 ms 1108 KB Output is correct
80 Correct 11 ms 1236 KB Output is correct
81 Correct 10 ms 1236 KB Output is correct
82 Correct 2 ms 468 KB Output is correct
83 Correct 7 ms 724 KB Output is correct
84 Correct 7 ms 980 KB Output is correct
85 Correct 8 ms 1108 KB Output is correct
86 Correct 2 ms 468 KB Output is correct
87 Correct 6 ms 980 KB Output is correct
88 Correct 9 ms 1136 KB Output is correct
89 Correct 16 ms 1356 KB Output is correct
90 Correct 24 ms 2260 KB Output is correct
91 Correct 28 ms 2916 KB Output is correct
92 Correct 33 ms 3036 KB Output is correct
93 Correct 18 ms 1352 KB Output is correct
94 Correct 26 ms 2536 KB Output is correct
95 Correct 30 ms 3016 KB Output is correct
96 Correct 31 ms 2224 KB Output is correct
97 Correct 43 ms 3528 KB Output is correct
98 Correct 51 ms 4476 KB Output is correct
99 Correct 59 ms 5160 KB Output is correct
100 Correct 59 ms 5268 KB Output is correct
101 Correct 0 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 31 ms 2252 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 3 ms 468 KB Output is correct
106 Correct 5 ms 724 KB Output is correct
107 Correct 2 ms 564 KB Output is correct
108 Correct 2 ms 468 KB Output is correct
109 Correct 16 ms 1348 KB Output is correct
110 Correct 15 ms 1288 KB Output is correct
111 Correct 31 ms 2204 KB Output is correct
112 Correct 0 ms 212 KB Output is correct
113 Correct 0 ms 212 KB Output is correct
114 Correct 44 ms 3564 KB Output is correct
115 Correct 8 ms 1108 KB Output is correct
116 Correct 3 ms 468 KB Output is correct
117 Correct 30 ms 2992 KB Output is correct
118 Correct 19 ms 1868 KB Output is correct
119 Correct 51 ms 4456 KB Output is correct
120 Correct 50 ms 4552 KB Output is correct
121 Correct 52 ms 4520 KB Output is correct
122 Correct 53 ms 4544 KB Output is correct
123 Correct 38 ms 2184 KB Output is correct
124 Correct 44 ms 3528 KB Output is correct
125 Correct 52 ms 4536 KB Output is correct
126 Correct 53 ms 4488 KB Output is correct
127 Correct 57 ms 5056 KB Output is correct
128 Correct 59 ms 5320 KB Output is correct