Submission #975469

# Submission time Handle Problem Language Result Execution time Memory
975469 2024-05-05T08:46:13 Z yellowtoad Vision Program (IOI19_vision) C++17
100 / 100
20 ms 2172 KB
#include "vision.h"
#include <iostream>
#include <vector>
#define andd add_and
#define orr add_or
#define xorr add_xor
using namespace std;

int vert[210], hor[210], u[210], d[210], l[210], r[210], pos, xx[410], yy[410], x, y;
vector<int> tmp, ns;

void construct_network(int n, int m, int k) {
	for (int i = 0; i < n; i++) {
		tmp.clear();
		for (int j = 0; j < m; j++) tmp.push_back(i*m+j);
		hor[i] = orr(tmp);
	}
	u[0] = hor[0];
	d[n-1] = hor[n-1];
	for (int i = 1; i < n; i++) u[i] = orr({u[i-1],hor[i]});
	for (int i = n-2; i >= 0; i--) d[i] = orr({d[i+1],hor[i]});
	for (int i = k+1; i < n; i++) ns.push_back(andd({hor[i],u[i-k-1]}));
	for (int i = n-k-2; i >= 0; i--) ns.push_back(andd({hor[i],d[i+k+1]}));

	for (int i = 0; i < m; i++) {
		tmp.clear();
		for (int j = 0; j < n; j++) tmp.push_back(j*m+i);
		vert[i] = orr(tmp);
	}
	l[0] = vert[0];
	r[m-1] = vert[m-1];
	for (int i = 1; i < m; i++) l[i] = orr({l[i-1],vert[i]});
	for (int i = m-2; i >= 0; i--) r[i] = orr({r[i+1],vert[i]});
	for (int i = k+1; i < m; i++) ns.push_back(andd({vert[i],l[i-k-1]}));
	for (int i = m-k-2; i >= 0; i--) ns.push_back(andd({vert[i],r[i+k+1]}));
	
	if (ns.size()) pos = add_not(orr(ns));
	ns.clear();

	for (int i = 0; i <= 400; i++) {
		tmp.clear();
		x = n-1; y = i;
		while ((x >= 0) && (y >= 0)) {
			if ((x < n) && (y < m)) tmp.push_back(x*m+y);
			x--; y--;
		}
		if (tmp.size()) xx[i] = orr(tmp);
	}
	for (int i = 0; xx[i+k]; i++) ns.push_back(andd({xx[i],xx[i+k]}));

	for (int i = 0; i <= 400; i++) {
		tmp.clear();
		x = 0; y = i;
		while ((x < n) && (y >= 0)) {
			if ((0 <= x) && (y < m)) tmp.push_back(x*m+y);
			x++; y--;
		}
		if (tmp.size()) yy[i] = orr(tmp);
	}
	for (int i = 0; yy[i+k]; i++) ns.push_back(andd({yy[i],yy[i+k]}));

	if (pos) andd({pos,orr(ns)});
	else orr(ns);
}
# 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 1 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 436 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 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 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 1 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 436 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 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 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 0 ms 600 KB Output is correct
26 Correct 1 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 1 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 436 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 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 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 0 ms 600 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 600 KB Output is correct
28 Correct 1 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 348 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 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 1 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 436 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 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 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 0 ms 600 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 600 KB Output is correct
28 Correct 1 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 348 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 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 5 ms 860 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 3 ms 860 KB Output is correct
42 Correct 2 ms 600 KB Output is correct
43 Correct 4 ms 856 KB Output is correct
44 Correct 4 ms 860 KB Output is correct
45 Correct 4 ms 860 KB Output is correct
46 Correct 4 ms 860 KB Output is correct
47 Correct 4 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 544 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 440 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 440 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 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 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 3 ms 764 KB Output is correct
9 Correct 3 ms 644 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 436 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 8 ms 1372 KB Output is correct
21 Correct 8 ms 1372 KB Output is correct
22 Correct 8 ms 1204 KB Output is correct
23 Correct 8 ms 1116 KB Output is correct
24 Correct 8 ms 1372 KB Output is correct
25 Correct 8 ms 1232 KB Output is correct
26 Correct 7 ms 1112 KB Output is correct
27 Correct 16 ms 2140 KB Output is correct
28 Correct 15 ms 2136 KB Output is correct
29 Correct 14 ms 2136 KB Output is correct
30 Correct 15 ms 2144 KB Output is correct
31 Correct 14 ms 2140 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2156 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 2 ms 856 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 8 ms 1404 KB Output is correct
8 Correct 8 ms 1368 KB Output is correct
9 Correct 17 ms 2140 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 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 1 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 436 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 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 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 0 ms 600 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 600 KB Output is correct
28 Correct 1 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 348 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 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 5 ms 860 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 3 ms 860 KB Output is correct
42 Correct 2 ms 600 KB Output is correct
43 Correct 4 ms 856 KB Output is correct
44 Correct 4 ms 860 KB Output is correct
45 Correct 4 ms 860 KB Output is correct
46 Correct 4 ms 860 KB Output is correct
47 Correct 4 ms 856 KB Output is correct
48 Correct 1 ms 544 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 456 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 2 ms 348 KB Output is correct
54 Correct 2 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 440 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 440 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 344 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 344 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 2 ms 604 KB Output is correct
73 Correct 2 ms 604 KB Output is correct
74 Correct 2 ms 604 KB Output is correct
75 Correct 2 ms 348 KB Output is correct
76 Correct 2 ms 348 KB Output is correct
77 Correct 3 ms 764 KB Output is correct
78 Correct 3 ms 644 KB Output is correct
79 Correct 3 ms 604 KB Output is correct
80 Correct 3 ms 604 KB Output is correct
81 Correct 3 ms 604 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 436 KB Output is correct
86 Correct 2 ms 348 KB Output is correct
87 Correct 2 ms 348 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 8 ms 1372 KB Output is correct
90 Correct 8 ms 1372 KB Output is correct
91 Correct 8 ms 1204 KB Output is correct
92 Correct 8 ms 1116 KB Output is correct
93 Correct 8 ms 1372 KB Output is correct
94 Correct 8 ms 1232 KB Output is correct
95 Correct 7 ms 1112 KB Output is correct
96 Correct 16 ms 2140 KB Output is correct
97 Correct 15 ms 2136 KB Output is correct
98 Correct 14 ms 2136 KB Output is correct
99 Correct 15 ms 2144 KB Output is correct
100 Correct 14 ms 2140 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 20 ms 2156 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 2 ms 856 KB Output is correct
106 Correct 3 ms 604 KB Output is correct
107 Correct 2 ms 348 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 8 ms 1404 KB Output is correct
110 Correct 8 ms 1368 KB Output is correct
111 Correct 17 ms 2140 KB Output is correct
112 Correct 1 ms 344 KB Output is correct
113 Correct 1 ms 348 KB Output is correct
114 Correct 15 ms 2172 KB Output is correct
115 Correct 1 ms 344 KB Output is correct
116 Correct 1 ms 348 KB Output is correct
117 Correct 9 ms 1116 KB Output is correct
118 Correct 9 ms 1372 KB Output is correct
119 Correct 14 ms 2140 KB Output is correct
120 Correct 14 ms 2140 KB Output is correct
121 Correct 18 ms 2136 KB Output is correct
122 Correct 17 ms 2136 KB Output is correct
123 Correct 15 ms 2140 KB Output is correct
124 Correct 14 ms 2136 KB Output is correct
125 Correct 15 ms 2140 KB Output is correct
126 Correct 15 ms 1944 KB Output is correct
127 Correct 18 ms 2140 KB Output is correct
128 Correct 14 ms 2140 KB Output is correct