Submission #979528

# Submission time Handle Problem Language Result Execution time Memory
979528 2024-05-11T07:20:45 Z yhkhoo Vision Program (IOI19_vision) C++17
100 / 100
37 ms 4700 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

void construct_network(int H, int W, int K){
	if(H*W == 2){
		add_or({0, 1});
		return;
	}
	int d = H+W-1, mhw = min(H, W);
	int hw = add_and({0, 1, 2});
	vector<int> d1v;
	d1v.reserve(d);
	for(int i=0; i<d; i++){
		vector<int> cur;
		for(int j=0; j<H; j++){
			int ch = j, cw = i-j;
			if(ch > -1 && ch < H && cw > -1 && cw < W){
				cur.pb(cw + ch*W);
			}
		}
		if(!cur.size()){
			cerr << 'i' << i << '\n';
		}
		d1v.pb(add_or(cur));
	}
	vector<int> d2v;
	d2v.reserve(d);
	for(int i=0; i<d; i++){
		vector<int> cur;
		for(int j=0; j<H; j++){
			int ch = j, cw = W-1-i+j;
			if(ch > -1 && ch < H && cw > -1 && cw < W){
				cur.pb(cw + ch*W);
			}
		}
		if(!cur.size()){
			cerr << 'i' << i << '\n';
		}
		d2v.pb(add_or(cur));
	}
	vector<int> k1v, k2v, j1v, j2v;
	int o1 = add_xor(d1v), o2 = add_xor(d2v);
	k1v.pb(o1); j1v.pb(o1);
	k2v.pb(o2); j2v.pb(o2);
	vector<int> pro;
	for(int i=0; i<K; i++){
		pro.pb(d1v[i]);
	}
	for(int j=K; j<d; j++){
		pro.pb(d1v[j]);
		k1v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
		pro.erase(pro.begin());
	}
	pro.clear();
	for(int i=0; i<K; i++){
		pro.pb(d2v[i]);
	}
	for(int j=K; j<d; j++){
		pro.pb(d2v[j]);
		k2v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
		pro.erase(pro.begin());
		
	}
	pro.clear();
	for(int i=0; i<K-1; i++){
		pro.pb(d1v[i]);
	}
	for(int j=K-1; j<d; j++){
		pro.pb(d1v[j]);
		j1v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
		pro.erase(pro.begin());
		
	}
	pro.clear();
	for(int i=0; i<K-1; i++){
		pro.pb(d2v[i]);
	}
	for(int j=K-1; j<d; j++){
		pro.pb(d2v[j]);
		j2v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
		pro.erase(pro.begin());
	}
	pro.clear();
	int k1 = add_or(k1v), k2 = add_or(k2v), j1, j2;
	if(K!=1){
		j1 = add_or(j1v), j2 = add_or(j2v);
	}
	else{
		j1 = hw, j2 = hw;
	}
	int nc = add_or({add_not(k1), add_not(k2)}), c1 = add_and({k1, add_not(j1)}), c2 = add_and({k2, add_not(j2)});
	cerr << nc << ' ' << c1 << ' ' << c2 << '\n';
	add_and({add_not(nc), add_or({c1, c2})});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:12:17: warning: unused variable 'mhw' [-Wunused-variable]
   12 |  int d = H+W-1, mhw = min(H, W);
      |                 ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 432 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 432 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 440 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 432 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 440 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 600 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 736 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 2 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 432 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 440 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 600 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 736 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 2 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 8 ms 1372 KB Output is correct
39 Correct 2 ms 600 KB Output is correct
40 Correct 2 ms 600 KB Output is correct
41 Correct 2 ms 752 KB Output is correct
42 Correct 2 ms 344 KB Output is correct
43 Correct 4 ms 856 KB Output is correct
44 Correct 9 ms 1372 KB Output is correct
45 Correct 9 ms 1368 KB Output is correct
46 Correct 7 ms 1116 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 7 ms 1116 KB Output is correct
3 Correct 7 ms 1116 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
6 Correct 7 ms 1112 KB Output is correct
7 Correct 6 ms 1084 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 6 ms 1112 KB Output is correct
11 Correct 7 ms 1116 KB Output is correct
12 Correct 7 ms 1044 KB Output is correct
13 Correct 6 ms 860 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 7 ms 1116 KB Output is correct
17 Correct 7 ms 1112 KB Output is correct
18 Correct 8 ms 1300 KB Output is correct
19 Correct 5 ms 856 KB Output is correct
20 Correct 1 ms 504 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 4 ms 856 KB Output is correct
5 Correct 4 ms 860 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 6 ms 1116 KB Output is correct
10 Correct 7 ms 1116 KB Output is correct
11 Correct 5 ms 860 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 6 ms 1116 KB Output is correct
15 Correct 6 ms 860 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 7 ms 1140 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 5 ms 1240 KB Output is correct
21 Correct 18 ms 2636 KB Output is correct
22 Correct 17 ms 2396 KB Output is correct
23 Correct 4 ms 860 KB Output is correct
24 Correct 7 ms 1240 KB Output is correct
25 Correct 19 ms 2652 KB Output is correct
26 Correct 4 ms 860 KB Output is correct
27 Correct 9 ms 1752 KB Output is correct
28 Correct 28 ms 3800 KB Output is correct
29 Correct 34 ms 4700 KB Output is correct
30 Correct 28 ms 3664 KB Output is correct
31 Correct 8 ms 1112 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1752 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 6 ms 1208 KB Output is correct
8 Correct 7 ms 1236 KB Output is correct
9 Correct 10 ms 1752 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 432 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 440 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 600 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 736 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 2 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 8 ms 1372 KB Output is correct
39 Correct 2 ms 600 KB Output is correct
40 Correct 2 ms 600 KB Output is correct
41 Correct 2 ms 752 KB Output is correct
42 Correct 2 ms 344 KB Output is correct
43 Correct 4 ms 856 KB Output is correct
44 Correct 9 ms 1372 KB Output is correct
45 Correct 9 ms 1368 KB Output is correct
46 Correct 7 ms 1116 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 2 ms 604 KB Output is correct
49 Correct 7 ms 1116 KB Output is correct
50 Correct 7 ms 1116 KB Output is correct
51 Correct 1 ms 344 KB Output is correct
52 Correct 3 ms 604 KB Output is correct
53 Correct 7 ms 1112 KB Output is correct
54 Correct 6 ms 1084 KB Output is correct
55 Correct 1 ms 344 KB Output is correct
56 Correct 2 ms 600 KB Output is correct
57 Correct 6 ms 1112 KB Output is correct
58 Correct 7 ms 1116 KB Output is correct
59 Correct 7 ms 1044 KB Output is correct
60 Correct 6 ms 860 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 2 ms 604 KB Output is correct
63 Correct 7 ms 1116 KB Output is correct
64 Correct 7 ms 1112 KB Output is correct
65 Correct 8 ms 1300 KB Output is correct
66 Correct 5 ms 856 KB Output is correct
67 Correct 1 ms 504 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 2 ms 604 KB Output is correct
73 Correct 4 ms 856 KB Output is correct
74 Correct 4 ms 860 KB Output is correct
75 Correct 3 ms 604 KB Output is correct
76 Correct 1 ms 348 KB Output is correct
77 Correct 2 ms 604 KB Output is correct
78 Correct 6 ms 1116 KB Output is correct
79 Correct 7 ms 1116 KB Output is correct
80 Correct 5 ms 860 KB Output is correct
81 Correct 2 ms 348 KB Output is correct
82 Correct 2 ms 604 KB Output is correct
83 Correct 6 ms 1116 KB Output is correct
84 Correct 6 ms 860 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 2 ms 604 KB Output is correct
87 Correct 7 ms 1140 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 5 ms 1240 KB Output is correct
90 Correct 18 ms 2636 KB Output is correct
91 Correct 17 ms 2396 KB Output is correct
92 Correct 4 ms 860 KB Output is correct
93 Correct 7 ms 1240 KB Output is correct
94 Correct 19 ms 2652 KB Output is correct
95 Correct 4 ms 860 KB Output is correct
96 Correct 9 ms 1752 KB Output is correct
97 Correct 28 ms 3800 KB Output is correct
98 Correct 34 ms 4700 KB Output is correct
99 Correct 28 ms 3664 KB Output is correct
100 Correct 8 ms 1112 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 9 ms 1752 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 2 ms 600 KB Output is correct
106 Correct 3 ms 604 KB Output is correct
107 Correct 2 ms 604 KB Output is correct
108 Correct 2 ms 604 KB Output is correct
109 Correct 6 ms 1208 KB Output is correct
110 Correct 7 ms 1236 KB Output is correct
111 Correct 10 ms 1752 KB Output is correct
112 Correct 0 ms 348 KB Output is correct
113 Correct 0 ms 344 KB Output is correct
114 Correct 28 ms 4008 KB Output is correct
115 Correct 1 ms 344 KB Output is correct
116 Correct 2 ms 800 KB Output is correct
117 Correct 12 ms 1884 KB Output is correct
118 Correct 14 ms 2008 KB Output is correct
119 Correct 33 ms 4444 KB Output is correct
120 Correct 33 ms 4444 KB Output is correct
121 Correct 34 ms 4424 KB Output is correct
122 Correct 34 ms 4432 KB Output is correct
123 Correct 9 ms 1752 KB Output is correct
124 Correct 28 ms 3788 KB Output is correct
125 Correct 37 ms 4688 KB Output is correct
126 Correct 35 ms 4468 KB Output is correct
127 Correct 27 ms 3664 KB Output is correct
128 Correct 8 ms 1116 KB Output is correct