Submission #590572

# Submission time Handle Problem Language Result Execution time Memory
590572 2022-07-06T06:43:31 Z 8e7 Vision Program (IOI19_vision) C++17
100 / 100
29 ms 2940 KB
//Challenge: Accepted
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
	while (l != r)cout << *l << " ", l++;
	cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second

void construct_network(int H, int W, int K) {
	vector<int> ask;
	int cur = H*W;
	for (int x = 0;x < H + W - 1;x++) {
		ask.clear();
		for (int i = 0;i < H;i++) {
			int j = x - i;
			if (j >= 0 && j < W) {
				ask.push_back(i*W + j);
			}
		}
		add_or(ask);	
		cur++;
	}
	for (int x = -H + 1;x < W;x++) {
		ask.clear();
		for (int i = 0;i < H;i++) {
			int j = i + x;
			if (j >= 0 && j < W) {
				ask.push_back(i*W + j);
			}
		}
		add_or(ask);
		cur++;
	}
	auto id_ru = [&] (int x) {
		return x + H*W;
	};
	auto id_dl = [&] (int x){
		return x + H*W + H + W - 1;
	};

	vector<int> has;
	for (int i = 0;i + K < H + W - 1;i++) {
		ask.clear();
		ask.push_back(id_ru(i));
		ask.push_back(id_ru(i+K));
		add_and(ask);
		has.push_back(cur);
		cur++;
	}
	int hask = cur-1;
	for (int i = 0;i + K < H + W - 1;i++) {
		ask.clear();
		ask.push_back(id_dl(i));
		ask.push_back(id_dl(i+K));
		add_and(ask);
		has.push_back(cur);
		cur++;
	}
	add_or(has);
	hask = cur++;


	vector<int> check(1, hask);
	for (int i = 0;i + K + 1 < H + W - 1;i++) {
		ask.clear(), has.clear();
		has.push_back(id_ru(i));
		for (int j = i + K + 1;j < H + W - 1;j++) {
			ask.push_back(id_ru(j));
		}
		add_or(ask);
		has.push_back(cur);
		cur++;
		add_and(has);
		add_not(cur);
		check.push_back(cur + 1);
		cur += 2;

		ask.clear(), has.clear();
		has.push_back(id_dl(i));
		for (int j = i + K + 1;j < H + W - 1;j++) {
			ask.push_back(id_dl(j));
		}
		add_or(ask);
		has.push_back(cur);
		cur++;
		add_and(has);
		add_not(cur);
		check.push_back(cur + 1);
		cur += 2;
	}
	add_and(check);
		

	/*
	std::vector<int> Ns;
	Ns = {0, 1};
	int a = add_and(Ns);
	Ns = {0, a};
	int b = add_or(Ns);
	Ns = {0, 1, b};
	int c = add_xor(Ns);
	add_not(c);
	*/
}
# Verdict Execution time Memory 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 1 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 292 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 240 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 0 ms 300 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory 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 1 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 292 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 240 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 0 ms 300 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 296 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
# Verdict Execution time Memory 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 1 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 292 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 240 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 0 ms 300 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 296 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 0 ms 212 KB Output is correct
30 Correct 1 ms 292 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory 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 1 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 292 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 240 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 0 ms 300 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 296 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 0 ms 212 KB Output is correct
30 Correct 1 ms 292 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 5 ms 724 KB Output is correct
39 Correct 2 ms 436 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 2 ms 340 KB Output is correct
43 Correct 7 ms 980 KB Output is correct
44 Correct 5 ms 808 KB Output is correct
45 Correct 3 ms 684 KB Output is correct
46 Correct 3 ms 532 KB Output is correct
47 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 724 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 4 ms 724 KB Output is correct
6 Correct 3 ms 548 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 5 ms 724 KB Output is correct
10 Correct 3 ms 596 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 2 ms 472 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 5 ms 724 KB Output is correct
16 Correct 3 ms 596 KB Output is correct
17 Correct 2 ms 424 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 304 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 216 KB Output is correct
22 Correct 0 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 216 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 5 ms 728 KB Output is correct
9 Correct 4 ms 668 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 400 KB Output is correct
12 Correct 2 ms 436 KB Output is correct
13 Correct 4 ms 736 KB Output is correct
14 Correct 3 ms 560 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 5 ms 660 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 216 KB Output is correct
20 Correct 13 ms 1772 KB Output is correct
21 Correct 8 ms 1248 KB Output is correct
22 Correct 5 ms 860 KB Output is correct
23 Correct 4 ms 692 KB Output is correct
24 Correct 13 ms 1752 KB Output is correct
25 Correct 7 ms 988 KB Output is correct
26 Correct 5 ms 608 KB Output is correct
27 Correct 29 ms 2896 KB Output is correct
28 Correct 16 ms 2132 KB Output is correct
29 Correct 12 ms 1672 KB Output is correct
30 Correct 9 ms 1196 KB Output is correct
31 Correct 8 ms 1068 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 2940 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 5 ms 808 KB Output is correct
5 Correct 5 ms 724 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 12 ms 1748 KB Output is correct
8 Correct 13 ms 1748 KB Output is correct
9 Correct 22 ms 2900 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory 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 1 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 292 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 240 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 304 KB Output is correct
17 Correct 0 ms 300 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 296 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 0 ms 212 KB Output is correct
30 Correct 1 ms 292 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 5 ms 724 KB Output is correct
39 Correct 2 ms 436 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 2 ms 340 KB Output is correct
43 Correct 7 ms 980 KB Output is correct
44 Correct 5 ms 808 KB Output is correct
45 Correct 3 ms 684 KB Output is correct
46 Correct 3 ms 532 KB Output is correct
47 Correct 2 ms 468 KB Output is correct
48 Correct 5 ms 724 KB Output is correct
49 Correct 2 ms 468 KB Output is correct
50 Correct 2 ms 468 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 4 ms 724 KB Output is correct
53 Correct 3 ms 548 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 5 ms 724 KB Output is correct
57 Correct 3 ms 596 KB Output is correct
58 Correct 2 ms 468 KB Output is correct
59 Correct 2 ms 472 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 1 ms 304 KB Output is correct
62 Correct 5 ms 724 KB Output is correct
63 Correct 3 ms 596 KB Output is correct
64 Correct 2 ms 424 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 1 ms 304 KB Output is correct
67 Correct 1 ms 212 KB Output is correct
68 Correct 0 ms 216 KB Output is correct
69 Correct 0 ms 304 KB Output is correct
70 Correct 0 ms 216 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 3 ms 596 KB Output is correct
73 Correct 2 ms 472 KB Output is correct
74 Correct 3 ms 468 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 340 KB Output is correct
77 Correct 5 ms 728 KB Output is correct
78 Correct 4 ms 668 KB Output is correct
79 Correct 2 ms 468 KB Output is correct
80 Correct 2 ms 400 KB Output is correct
81 Correct 2 ms 436 KB Output is correct
82 Correct 4 ms 736 KB Output is correct
83 Correct 3 ms 560 KB Output is correct
84 Correct 1 ms 344 KB Output is correct
85 Correct 1 ms 304 KB Output is correct
86 Correct 5 ms 660 KB Output is correct
87 Correct 2 ms 468 KB Output is correct
88 Correct 1 ms 216 KB Output is correct
89 Correct 13 ms 1772 KB Output is correct
90 Correct 8 ms 1248 KB Output is correct
91 Correct 5 ms 860 KB Output is correct
92 Correct 4 ms 692 KB Output is correct
93 Correct 13 ms 1752 KB Output is correct
94 Correct 7 ms 988 KB Output is correct
95 Correct 5 ms 608 KB Output is correct
96 Correct 29 ms 2896 KB Output is correct
97 Correct 16 ms 2132 KB Output is correct
98 Correct 12 ms 1672 KB Output is correct
99 Correct 9 ms 1196 KB Output is correct
100 Correct 8 ms 1068 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 23 ms 2940 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 3 ms 596 KB Output is correct
106 Correct 5 ms 808 KB Output is correct
107 Correct 5 ms 724 KB Output is correct
108 Correct 5 ms 724 KB Output is correct
109 Correct 12 ms 1748 KB Output is correct
110 Correct 13 ms 1748 KB Output is correct
111 Correct 22 ms 2900 KB Output is correct
112 Correct 0 ms 212 KB Output is correct
113 Correct 0 ms 212 KB Output is correct
114 Correct 16 ms 2148 KB Output is correct
115 Correct 1 ms 212 KB Output is correct
116 Correct 5 ms 684 KB Output is correct
117 Correct 4 ms 760 KB Output is correct
118 Correct 10 ms 1528 KB Output is correct
119 Correct 12 ms 1620 KB Output is correct
120 Correct 14 ms 1648 KB Output is correct
121 Correct 12 ms 1580 KB Output is correct
122 Correct 12 ms 1588 KB Output is correct
123 Correct 23 ms 2908 KB Output is correct
124 Correct 16 ms 2220 KB Output is correct
125 Correct 12 ms 1580 KB Output is correct
126 Correct 12 ms 1700 KB Output is correct
127 Correct 9 ms 1236 KB Output is correct
128 Correct 8 ms 1036 KB Output is correct