답안 #376338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
376338 2021-03-11T09:19:29 Z InternetPerson10 Vision Program (IOI19_vision) C++14
100 / 100
89 ms 8168 KB
#include <bits/stdc++.h>
#include "vision.h"

using namespace std;

vector<int> N1, N2, N1_2, N1_3, N1_4, N1_5, N1_6, N2_2, N2_3, N2_4, N2_5, N2_6, nums, ph, ph2;

void construct_network(int H, int W, int K) {
	nums = {0, add_not(0)};
	int BLANK = add_and(nums);
	for(int i = 0; i < H+W-1; i++) {
		vector<int>().swap(nums);
		for(int j = max(0, i+1-W); j < min(H, i+1); j++) {
			nums.push_back(j*W + i-j);
			// cout << i << ' ' << j << '\n';
		}
		N1.push_back(add_xor(nums));
	}
	for(int i = 0; i < H+W-1; i++) {
		vector<int>().swap(nums);
		for(int j = max(0, i+1-W); j < min(H, i+1); j++) {
			nums.push_back((H-j-1)*W + i-j);
		}
		N2.push_back(add_xor(nums));
	}
	int X = N1.size(); // X = H + W - 1; X > K
	for(int i = 0; i < X+K; i++) {
		vector<int>().swap(nums);
		for(int j = max(0, i-K); j <= min(i, X-1); j++) {
			nums.push_back(N1[j]);
		}
		N1_2.push_back(add_xor(nums));
	}
	for(int i = 0; i < X+K; i++) {
		vector<int>().swap(nums);
		for(int j = max(0, i-K); j <= min(i, X-1); j++) {
			nums.push_back(N2[j]);
		}
		N2_2.push_back(add_xor(nums));
	}
	X = N1_2.size(); // X = H + W + K - 1; X > 2K
	for(int i = 0; i < X-2; i++) {
		vector<int>().swap(nums);
		nums.push_back(N1_2[i]);
		nums.push_back(add_not(N1_2[i+1]));
		nums.push_back(N1_2[i+2]);
		N1_3.push_back(add_and(nums));
	}
	for(int i = 0; i < X-2; i++) {
		vector<int>().swap(nums);
		nums.push_back(N2_2[i]);
		nums.push_back(add_not(N2_2[i+1]));
		nums.push_back(N2_2[i+2]);
		N2_3.push_back(add_and(nums));
	}
	K++;
	for(int i = 0; i <= X-2*K; i++) {
		vector<int>().swap(nums);
		nums.resize(2*K);
		for(int j = 0; j < 2*K; j++) nums[j] = N1_2[i+j];
		N1_4.push_back(add_and(nums));
	}
	for(int i = 0; i <= X-2*K; i++) {
		vector<int>().swap(nums);
		nums.resize(2*K);
		for(int j = 0; j < 2*K; j++) nums[j] = N2_2[i+j];
		N2_4.push_back(add_and(nums));
	}
	for(int i = 0; i <= X-K; i++) {
		vector<int>().swap(nums);
		nums.resize(K);
		for(int j = 0; j < K; j++) nums[j] = N1_2[i+j];
		N1_5.push_back(add_and(nums));
	}
	for(int i = 0; i <= X-K; i++) {
		vector<int>().swap(nums);
		nums.resize(K);
		for(int j = 0; j < K; j++) nums[j] = N2_2[i+j];
		N2_5.push_back(add_and(nums));
	}
	int good1 = add_or(N1_3), good2 = add_or(N2_3);
	if(N1_4.size()) N1_6.push_back(add_or(N1_4));
	else N1_6.push_back(BLANK);
	ph.push_back(add_or(N1_2));
	ph.push_back(add_or(N1_5));
	ph.push_back(add_not(add_xor(N1_5)));
	N1_6.push_back(add_and(ph));
	vector<int>().swap(ph);
	if(N2_4.size()) N2_6.push_back(add_or(N2_4));
	else N2_6.push_back(BLANK);
	ph.push_back(add_or(N2_2));
	ph.push_back(add_or(N2_5));
	ph.push_back(add_not(add_xor(N2_5)));
	N2_6.push_back(add_and(ph));
	vector<int>().swap(ph);
	int bad1 = add_or(N1_6), bad2 = add_or(N2_6);
	ph = {good1, good2};
	ph2 = {bad1, bad2};
	vector<int>().swap(nums);
	nums.push_back(add_or(ph));
	nums.push_back(add_not(add_or(ph2)));
	add_and(nums);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 640 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 640 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 640 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 2 ms 492 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 3 ms 492 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 2 ms 364 KB Output is correct
34 Correct 2 ms 492 KB Output is correct
35 Correct 3 ms 492 KB Output is correct
36 Correct 4 ms 492 KB Output is correct
37 Correct 3 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 640 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 2 ms 492 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 3 ms 492 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 2 ms 364 KB Output is correct
34 Correct 2 ms 492 KB Output is correct
35 Correct 3 ms 492 KB Output is correct
36 Correct 4 ms 492 KB Output is correct
37 Correct 3 ms 492 KB Output is correct
38 Correct 13 ms 1388 KB Output is correct
39 Correct 3 ms 492 KB Output is correct
40 Correct 7 ms 748 KB Output is correct
41 Correct 3 ms 620 KB Output is correct
42 Correct 13 ms 1388 KB Output is correct
43 Correct 5 ms 748 KB Output is correct
44 Correct 13 ms 1388 KB Output is correct
45 Correct 18 ms 1900 KB Output is correct
46 Correct 22 ms 2284 KB Output is correct
47 Correct 23 ms 2412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 620 KB Output is correct
2 Correct 15 ms 1516 KB Output is correct
3 Correct 16 ms 1516 KB Output is correct
4 Correct 28 ms 1900 KB Output is correct
5 Correct 3 ms 620 KB Output is correct
6 Correct 12 ms 1388 KB Output is correct
7 Correct 18 ms 1772 KB Output is correct
8 Correct 20 ms 1900 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Correct 10 ms 1132 KB Output is correct
11 Correct 16 ms 1516 KB Output is correct
12 Correct 16 ms 1516 KB Output is correct
13 Correct 19 ms 1900 KB Output is correct
14 Correct 21 ms 1900 KB Output is correct
15 Correct 2 ms 620 KB Output is correct
16 Correct 10 ms 1132 KB Output is correct
17 Correct 15 ms 1516 KB Output is correct
18 Correct 16 ms 1516 KB Output is correct
19 Correct 21 ms 1772 KB Output is correct
20 Correct 20 ms 1900 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 6 ms 748 KB Output is correct
5 Correct 10 ms 1004 KB Output is correct
6 Correct 15 ms 1132 KB Output is correct
7 Correct 10 ms 1132 KB Output is correct
8 Correct 4 ms 620 KB Output is correct
9 Correct 10 ms 1132 KB Output is correct
10 Correct 15 ms 1516 KB Output is correct
11 Correct 18 ms 1644 KB Output is correct
12 Correct 21 ms 1772 KB Output is correct
13 Correct 2 ms 620 KB Output is correct
14 Correct 14 ms 1388 KB Output is correct
15 Correct 18 ms 1772 KB Output is correct
16 Correct 21 ms 1900 KB Output is correct
17 Correct 2 ms 620 KB Output is correct
18 Correct 16 ms 1516 KB Output is correct
19 Correct 20 ms 1900 KB Output is correct
20 Correct 8 ms 1004 KB Output is correct
21 Correct 33 ms 3052 KB Output is correct
22 Correct 45 ms 4328 KB Output is correct
23 Correct 52 ms 4712 KB Output is correct
24 Correct 8 ms 1004 KB Output is correct
25 Correct 38 ms 3688 KB Output is correct
26 Correct 51 ms 4712 KB Output is correct
27 Correct 14 ms 1644 KB Output is correct
28 Correct 46 ms 4328 KB Output is correct
29 Correct 68 ms 6248 KB Output is correct
30 Correct 83 ms 7560 KB Output is correct
31 Correct 86 ms 7912 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1644 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 4 ms 620 KB Output is correct
5 Correct 2 ms 620 KB Output is correct
6 Correct 2 ms 620 KB Output is correct
7 Correct 8 ms 1004 KB Output is correct
8 Correct 8 ms 1004 KB Output is correct
9 Correct 14 ms 1644 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 640 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 2 ms 492 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 3 ms 492 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 2 ms 364 KB Output is correct
34 Correct 2 ms 492 KB Output is correct
35 Correct 3 ms 492 KB Output is correct
36 Correct 4 ms 492 KB Output is correct
37 Correct 3 ms 492 KB Output is correct
38 Correct 13 ms 1388 KB Output is correct
39 Correct 3 ms 492 KB Output is correct
40 Correct 7 ms 748 KB Output is correct
41 Correct 3 ms 620 KB Output is correct
42 Correct 13 ms 1388 KB Output is correct
43 Correct 5 ms 748 KB Output is correct
44 Correct 13 ms 1388 KB Output is correct
45 Correct 18 ms 1900 KB Output is correct
46 Correct 22 ms 2284 KB Output is correct
47 Correct 23 ms 2412 KB Output is correct
48 Correct 2 ms 620 KB Output is correct
49 Correct 15 ms 1516 KB Output is correct
50 Correct 16 ms 1516 KB Output is correct
51 Correct 28 ms 1900 KB Output is correct
52 Correct 3 ms 620 KB Output is correct
53 Correct 12 ms 1388 KB Output is correct
54 Correct 18 ms 1772 KB Output is correct
55 Correct 20 ms 1900 KB Output is correct
56 Correct 2 ms 620 KB Output is correct
57 Correct 10 ms 1132 KB Output is correct
58 Correct 16 ms 1516 KB Output is correct
59 Correct 16 ms 1516 KB Output is correct
60 Correct 19 ms 1900 KB Output is correct
61 Correct 21 ms 1900 KB Output is correct
62 Correct 2 ms 620 KB Output is correct
63 Correct 10 ms 1132 KB Output is correct
64 Correct 15 ms 1516 KB Output is correct
65 Correct 16 ms 1516 KB Output is correct
66 Correct 21 ms 1772 KB Output is correct
67 Correct 20 ms 1900 KB Output is correct
68 Correct 1 ms 364 KB Output is correct
69 Correct 1 ms 364 KB Output is correct
70 Correct 1 ms 364 KB Output is correct
71 Correct 1 ms 364 KB Output is correct
72 Correct 2 ms 492 KB Output is correct
73 Correct 6 ms 748 KB Output is correct
74 Correct 10 ms 1004 KB Output is correct
75 Correct 15 ms 1132 KB Output is correct
76 Correct 10 ms 1132 KB Output is correct
77 Correct 4 ms 620 KB Output is correct
78 Correct 10 ms 1132 KB Output is correct
79 Correct 15 ms 1516 KB Output is correct
80 Correct 18 ms 1644 KB Output is correct
81 Correct 21 ms 1772 KB Output is correct
82 Correct 2 ms 620 KB Output is correct
83 Correct 14 ms 1388 KB Output is correct
84 Correct 18 ms 1772 KB Output is correct
85 Correct 21 ms 1900 KB Output is correct
86 Correct 2 ms 620 KB Output is correct
87 Correct 16 ms 1516 KB Output is correct
88 Correct 20 ms 1900 KB Output is correct
89 Correct 8 ms 1004 KB Output is correct
90 Correct 33 ms 3052 KB Output is correct
91 Correct 45 ms 4328 KB Output is correct
92 Correct 52 ms 4712 KB Output is correct
93 Correct 8 ms 1004 KB Output is correct
94 Correct 38 ms 3688 KB Output is correct
95 Correct 51 ms 4712 KB Output is correct
96 Correct 14 ms 1644 KB Output is correct
97 Correct 46 ms 4328 KB Output is correct
98 Correct 68 ms 6248 KB Output is correct
99 Correct 83 ms 7560 KB Output is correct
100 Correct 86 ms 7912 KB Output is correct
101 Correct 1 ms 364 KB Output is correct
102 Correct 1 ms 364 KB Output is correct
103 Correct 14 ms 1644 KB Output is correct
104 Correct 1 ms 364 KB Output is correct
105 Correct 2 ms 492 KB Output is correct
106 Correct 4 ms 620 KB Output is correct
107 Correct 2 ms 620 KB Output is correct
108 Correct 2 ms 620 KB Output is correct
109 Correct 8 ms 1004 KB Output is correct
110 Correct 8 ms 1004 KB Output is correct
111 Correct 14 ms 1644 KB Output is correct
112 Correct 1 ms 364 KB Output is correct
113 Correct 1 ms 364 KB Output is correct
114 Correct 46 ms 4328 KB Output is correct
115 Correct 21 ms 1900 KB Output is correct
116 Correct 4 ms 620 KB Output is correct
117 Correct 48 ms 4504 KB Output is correct
118 Correct 21 ms 2284 KB Output is correct
119 Correct 74 ms 6248 KB Output is correct
120 Correct 79 ms 6248 KB Output is correct
121 Correct 71 ms 6292 KB Output is correct
122 Correct 75 ms 6248 KB Output is correct
123 Correct 14 ms 1652 KB Output is correct
124 Correct 47 ms 4328 KB Output is correct
125 Correct 68 ms 6248 KB Output is correct
126 Correct 68 ms 6248 KB Output is correct
127 Correct 85 ms 7528 KB Output is correct
128 Correct 89 ms 8168 KB Output is correct