답안 #201630

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
201630 2020-02-11T13:06:05 Z khulegub Vision Program (IOI19_vision) C++14
100 / 100
31 ms 2800 KB
#include "vision.h"
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define rr first
#define cc second

using namespace std;

typedef pair<int, int> pii;

int hh, ww, kk;

pii to_pair(int x){
	return mp(x / ww, x % ww);
}
int to_linear(pii x){
	return x.rr * ww + x.cc; 
}

void construct_network(int H, int W, int K) {

	// proj y
	hh = H, ww = W, kk = K;

	int one = add_or( {0, add_not(0)} ), zero = add_not(one);

	vector<int> proj_hor, hor;
	vector<int> proj_ver, ver;

	int bitlen = 10;

	vector<int> counter;

	for (int i = 0; i < ww; i++){
		vector<int> send;
		for (int j = 0; j < hh; j++){
			send.pb(j * ww + i);
		}
		proj_hor.pb(add_or(send));
	}

	for (int i = 0; i < hh; i++){
		vector<int> send;
		for (int j = 0; j < ww; j++){
			send.pb(i * ww + j);
		}
		proj_ver.pb(add_or(send));
	}
	for (int i = 0; i < hh; i++){
		vector<int> send_pre, send_suf;
		for (int j = 0; j <= i; j++){
			send_pre.pb(proj_ver[j]);
		}
		for (int j = i; j < hh; j++){
			send_suf.pb(proj_ver[j]);
		}
		ver.pb( add_and({add_or(send_pre), add_or(send_suf)}) );
	}

	for (int i = 0; i < ww; i++){
		vector<int> send_pre, send_suf;
		for (int j = 0; j <= i; j++){
			send_pre.pb(proj_hor[j]);
		}
		for (int j = i; j < ww; j++){
			send_suf.pb(proj_hor[j]);
		}
		hor.pb( add_and({add_or(send_pre), add_or(send_suf)}) );
	}

	

	// initialize
	for (int i = 0; i < bitlen; i++){
		counter.pb(zero);
	}

	for (int j = 0; j < ww; j++){
		int adder = hor[j];
		for (int i = 0; i < bitlen; i++){
			int tmp = counter[i];
			counter[i] = add_xor({counter[i], adder});
			adder = add_and({tmp, adder});
		}
	}
	for (int j = 0; j < hh; j++){
		int adder = ver[j];
		for (int i = 0; i < bitlen; i++){
			int tmp = counter[i];
			counter[i] = add_xor({counter[i], adder});
			adder = add_and({tmp, adder});
		}
	}

	kk = kk + 2;
	int last = one;
	vector<int> kkbits;

	for (int i = 0; i < bitlen; i++){
		kkbits.pb(kk % 2);
		kk /= 2;
	}

	for (int i = 0; i < bitlen; i++){
		if (kkbits[i]){
			last = add_and({last, counter[i]});
		}
		else{
			last = add_and({last, add_not(counter[i]) });
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 380 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 6 ms 380 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 380 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 6 ms 380 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 6 ms 504 KB Output is correct
29 Correct 6 ms 504 KB Output is correct
30 Correct 6 ms 380 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 6 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 6 ms 504 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 380 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 6 ms 380 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 6 ms 504 KB Output is correct
29 Correct 6 ms 504 KB Output is correct
30 Correct 6 ms 380 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 6 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 6 ms 504 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 504 KB Output is correct
38 Correct 11 ms 1012 KB Output is correct
39 Correct 7 ms 632 KB Output is correct
40 Correct 7 ms 632 KB Output is correct
41 Correct 10 ms 760 KB Output is correct
42 Correct 9 ms 760 KB Output is correct
43 Correct 12 ms 1144 KB Output is correct
44 Correct 12 ms 1012 KB Output is correct
45 Correct 12 ms 1012 KB Output is correct
46 Correct 12 ms 1016 KB Output is correct
47 Correct 11 ms 1012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1012 KB Output is correct
2 Correct 11 ms 1016 KB Output is correct
3 Correct 12 ms 1012 KB Output is correct
4 Correct 11 ms 1012 KB Output is correct
5 Correct 14 ms 1012 KB Output is correct
6 Correct 12 ms 1012 KB Output is correct
7 Correct 12 ms 1012 KB Output is correct
8 Correct 12 ms 1008 KB Output is correct
9 Correct 11 ms 1008 KB Output is correct
10 Correct 11 ms 1012 KB Output is correct
11 Correct 12 ms 1012 KB Output is correct
12 Correct 12 ms 1012 KB Output is correct
13 Correct 11 ms 1012 KB Output is correct
14 Correct 11 ms 1012 KB Output is correct
15 Correct 11 ms 1012 KB Output is correct
16 Correct 12 ms 1012 KB Output is correct
17 Correct 11 ms 1012 KB Output is correct
18 Correct 12 ms 1012 KB Output is correct
19 Correct 11 ms 1012 KB Output is correct
20 Correct 14 ms 1012 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 748 KB Output is correct
4 Correct 8 ms 748 KB Output is correct
5 Correct 9 ms 760 KB Output is correct
6 Correct 9 ms 760 KB Output is correct
7 Correct 9 ms 764 KB Output is correct
8 Correct 11 ms 1016 KB Output is correct
9 Correct 10 ms 1016 KB Output is correct
10 Correct 13 ms 1016 KB Output is correct
11 Correct 10 ms 1016 KB Output is correct
12 Correct 10 ms 1016 KB Output is correct
13 Correct 11 ms 1012 KB Output is correct
14 Correct 13 ms 1012 KB Output is correct
15 Correct 12 ms 1012 KB Output is correct
16 Correct 12 ms 1012 KB Output is correct
17 Correct 12 ms 1012 KB Output is correct
18 Correct 12 ms 1016 KB Output is correct
19 Correct 11 ms 1012 KB Output is correct
20 Correct 18 ms 1776 KB Output is correct
21 Correct 19 ms 1776 KB Output is correct
22 Correct 19 ms 1780 KB Output is correct
23 Correct 18 ms 1780 KB Output is correct
24 Correct 18 ms 1780 KB Output is correct
25 Correct 18 ms 1780 KB Output is correct
26 Correct 21 ms 1780 KB Output is correct
27 Correct 27 ms 2676 KB Output is correct
28 Correct 27 ms 2668 KB Output is correct
29 Correct 26 ms 2668 KB Output is correct
30 Correct 26 ms 2672 KB Output is correct
31 Correct 29 ms 2672 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 2672 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 8 ms 760 KB Output is correct
4 Correct 11 ms 1016 KB Output is correct
5 Correct 12 ms 1008 KB Output is correct
6 Correct 12 ms 1012 KB Output is correct
7 Correct 18 ms 1780 KB Output is correct
8 Correct 18 ms 1780 KB Output is correct
9 Correct 26 ms 2672 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 380 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 6 ms 380 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 6 ms 504 KB Output is correct
29 Correct 6 ms 504 KB Output is correct
30 Correct 6 ms 380 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 6 ms 504 KB Output is correct
34 Correct 6 ms 504 KB Output is correct
35 Correct 6 ms 504 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 504 KB Output is correct
38 Correct 11 ms 1012 KB Output is correct
39 Correct 7 ms 632 KB Output is correct
40 Correct 7 ms 632 KB Output is correct
41 Correct 10 ms 760 KB Output is correct
42 Correct 9 ms 760 KB Output is correct
43 Correct 12 ms 1144 KB Output is correct
44 Correct 12 ms 1012 KB Output is correct
45 Correct 12 ms 1012 KB Output is correct
46 Correct 12 ms 1016 KB Output is correct
47 Correct 11 ms 1012 KB Output is correct
48 Correct 11 ms 1012 KB Output is correct
49 Correct 11 ms 1016 KB Output is correct
50 Correct 12 ms 1012 KB Output is correct
51 Correct 11 ms 1012 KB Output is correct
52 Correct 14 ms 1012 KB Output is correct
53 Correct 12 ms 1012 KB Output is correct
54 Correct 12 ms 1012 KB Output is correct
55 Correct 12 ms 1008 KB Output is correct
56 Correct 11 ms 1008 KB Output is correct
57 Correct 11 ms 1012 KB Output is correct
58 Correct 12 ms 1012 KB Output is correct
59 Correct 12 ms 1012 KB Output is correct
60 Correct 11 ms 1012 KB Output is correct
61 Correct 11 ms 1012 KB Output is correct
62 Correct 11 ms 1012 KB Output is correct
63 Correct 12 ms 1012 KB Output is correct
64 Correct 11 ms 1012 KB Output is correct
65 Correct 12 ms 1012 KB Output is correct
66 Correct 11 ms 1012 KB Output is correct
67 Correct 14 ms 1012 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 5 ms 256 KB Output is correct
70 Correct 5 ms 376 KB Output is correct
71 Correct 5 ms 256 KB Output is correct
72 Correct 8 ms 748 KB Output is correct
73 Correct 8 ms 748 KB Output is correct
74 Correct 9 ms 760 KB Output is correct
75 Correct 9 ms 760 KB Output is correct
76 Correct 9 ms 764 KB Output is correct
77 Correct 11 ms 1016 KB Output is correct
78 Correct 10 ms 1016 KB Output is correct
79 Correct 13 ms 1016 KB Output is correct
80 Correct 10 ms 1016 KB Output is correct
81 Correct 10 ms 1016 KB Output is correct
82 Correct 11 ms 1012 KB Output is correct
83 Correct 13 ms 1012 KB Output is correct
84 Correct 12 ms 1012 KB Output is correct
85 Correct 12 ms 1012 KB Output is correct
86 Correct 12 ms 1012 KB Output is correct
87 Correct 12 ms 1016 KB Output is correct
88 Correct 11 ms 1012 KB Output is correct
89 Correct 18 ms 1776 KB Output is correct
90 Correct 19 ms 1776 KB Output is correct
91 Correct 19 ms 1780 KB Output is correct
92 Correct 18 ms 1780 KB Output is correct
93 Correct 18 ms 1780 KB Output is correct
94 Correct 18 ms 1780 KB Output is correct
95 Correct 21 ms 1780 KB Output is correct
96 Correct 27 ms 2676 KB Output is correct
97 Correct 27 ms 2668 KB Output is correct
98 Correct 26 ms 2668 KB Output is correct
99 Correct 26 ms 2672 KB Output is correct
100 Correct 29 ms 2672 KB Output is correct
101 Correct 6 ms 376 KB Output is correct
102 Correct 5 ms 256 KB Output is correct
103 Correct 28 ms 2672 KB Output is correct
104 Correct 5 ms 376 KB Output is correct
105 Correct 8 ms 760 KB Output is correct
106 Correct 11 ms 1016 KB Output is correct
107 Correct 12 ms 1008 KB Output is correct
108 Correct 12 ms 1012 KB Output is correct
109 Correct 18 ms 1780 KB Output is correct
110 Correct 18 ms 1780 KB Output is correct
111 Correct 26 ms 2672 KB Output is correct
112 Correct 5 ms 256 KB Output is correct
113 Correct 5 ms 256 KB Output is correct
114 Correct 27 ms 2672 KB Output is correct
115 Correct 13 ms 1000 KB Output is correct
116 Correct 12 ms 1016 KB Output is correct
117 Correct 18 ms 1780 KB Output is correct
118 Correct 18 ms 1776 KB Output is correct
119 Correct 25 ms 2672 KB Output is correct
120 Correct 27 ms 2672 KB Output is correct
121 Correct 27 ms 2672 KB Output is correct
122 Correct 27 ms 2672 KB Output is correct
123 Correct 26 ms 2672 KB Output is correct
124 Correct 30 ms 2672 KB Output is correct
125 Correct 26 ms 2672 KB Output is correct
126 Correct 31 ms 2800 KB Output is correct
127 Correct 26 ms 2668 KB Output is correct
128 Correct 28 ms 2672 KB Output is correct