Submission #211889

# Submission time Handle Problem Language Result Execution time Memory
211889 2020-03-21T15:13:54 Z MarcoMeijer Vision Program (IOI19_vision) C++14
100 / 100
43 ms 3828 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MX=500;

int h, w, k;

int getPos(int x, int y) {
	return x+y*w;
}
void construct_network(int H, int W, int K) {
	h=H, w=W, k=K;
	vi diagonal[2];
	vi diagonalXOR[2];
	vi ans;
	RE(i,w+h-1) {
		int x=i, y=0;
		if(x>=w) {
			y=x-w+1;
			x=w-1;
		}
		vi f;
		while(x>=0 && y<h) {
			f.pb(getPos(x,y));
			x--;
			y++;
		}
		diagonal[0].pb(add_or(f));
		diagonalXOR[0].pb(add_xor(f));
	}
	RE(i,w+h-1) {
		int x=0, y=h-i-1;
		if(y<0) {
			x=-y;
			y=0;
		}
		vi f;
		while(x<w && y<h) {
			f.pb(getPos(x,y));
			x++;
			y++;
		}
		diagonal[1].pb(add_or(f));
		diagonalXOR[1].pb(add_xor(f));
	}
	RE(i,2) {
		vi f;
		vi distK;
		RE(j,diagonal[i].size()-k) {
			vi g;
			g.pb(diagonal[i][j]);
			g.pb(diagonal[i][j+k]);
			distK.pb(add_and(g));
		}
		f.pb(add_or(distK));
		vi distLessK;
		RE(j,diagonalXOR[!i].size()) {
			vi g;
			g.pb(add_not(diagonalXOR[!i][j]));
			g.pb(diagonal[!i][j]);
			distLessK.pb(add_and(g));
		}
		RE(j,diagonal[!i].size()-k) {
			vi g;
			RE(l,k+1) {
				g.pb(diagonal[!i][j+l]);
			}
			int _xor=add_xor(g);
			int _or =add_or(g);
			g.clear();
			g.pb(add_not(_xor));
			g.pb(_or);
			distLessK.pb(add_and(g));
		}
		f.pb(add_or(distLessK));
		ans.pb(add_and(f));
	}
	add_or(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 6 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 408 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 6 ms 512 KB Output is correct
35 Correct 6 ms 384 KB Output is correct
36 Correct 6 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 6 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 408 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 6 ms 512 KB Output is correct
35 Correct 6 ms 384 KB Output is correct
36 Correct 6 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 14 ms 1280 KB Output is correct
39 Correct 4 ms 512 KB Output is correct
40 Correct 6 ms 504 KB Output is correct
41 Correct 8 ms 760 KB Output is correct
42 Correct 7 ms 640 KB Output is correct
43 Correct 10 ms 1024 KB Output is correct
44 Correct 15 ms 1280 KB Output is correct
45 Correct 14 ms 1280 KB Output is correct
46 Correct 13 ms 1152 KB Output is correct
47 Correct 9 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 640 KB Output is correct
2 Correct 10 ms 896 KB Output is correct
3 Correct 10 ms 896 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 6 ms 640 KB Output is correct
6 Correct 13 ms 896 KB Output is correct
7 Correct 11 ms 768 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 8 ms 640 KB Output is correct
10 Correct 9 ms 896 KB Output is correct
11 Correct 10 ms 896 KB Output is correct
12 Correct 10 ms 896 KB Output is correct
13 Correct 9 ms 768 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 6 ms 640 KB Output is correct
16 Correct 9 ms 896 KB Output is correct
17 Correct 10 ms 896 KB Output is correct
18 Correct 11 ms 896 KB Output is correct
19 Correct 9 ms 768 KB Output is correct
20 Correct 6 ms 512 KB Output is correct
21 Correct 4 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 7 ms 640 KB Output is correct
4 Correct 8 ms 672 KB Output is correct
5 Correct 8 ms 768 KB Output is correct
6 Correct 8 ms 640 KB Output is correct
7 Correct 9 ms 640 KB Output is correct
8 Correct 9 ms 768 KB Output is correct
9 Correct 11 ms 896 KB Output is correct
10 Correct 11 ms 1024 KB Output is correct
11 Correct 13 ms 896 KB Output is correct
12 Correct 8 ms 640 KB Output is correct
13 Correct 6 ms 640 KB Output is correct
14 Correct 11 ms 768 KB Output is correct
15 Correct 9 ms 768 KB Output is correct
16 Correct 5 ms 512 KB Output is correct
17 Correct 7 ms 640 KB Output is correct
18 Correct 10 ms 896 KB Output is correct
19 Correct 5 ms 512 KB Output is correct
20 Correct 15 ms 1532 KB Output is correct
21 Correct 21 ms 2172 KB Output is correct
22 Correct 22 ms 2176 KB Output is correct
23 Correct 14 ms 1408 KB Output is correct
24 Correct 15 ms 1532 KB Output is correct
25 Correct 23 ms 2304 KB Output is correct
26 Correct 14 ms 1280 KB Output is correct
27 Correct 25 ms 2424 KB Output is correct
28 Correct 37 ms 3572 KB Output is correct
29 Correct 38 ms 3828 KB Output is correct
30 Correct 32 ms 3324 KB Output is correct
31 Correct 23 ms 2176 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
33 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2420 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 7 ms 640 KB Output is correct
4 Correct 9 ms 768 KB Output is correct
5 Correct 7 ms 640 KB Output is correct
6 Correct 7 ms 640 KB Output is correct
7 Correct 15 ms 1532 KB Output is correct
8 Correct 16 ms 1532 KB Output is correct
9 Correct 23 ms 2428 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 6 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 408 KB Output is correct
33 Correct 6 ms 512 KB Output is correct
34 Correct 6 ms 512 KB Output is correct
35 Correct 6 ms 384 KB Output is correct
36 Correct 6 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 14 ms 1280 KB Output is correct
39 Correct 4 ms 512 KB Output is correct
40 Correct 6 ms 504 KB Output is correct
41 Correct 8 ms 760 KB Output is correct
42 Correct 7 ms 640 KB Output is correct
43 Correct 10 ms 1024 KB Output is correct
44 Correct 15 ms 1280 KB Output is correct
45 Correct 14 ms 1280 KB Output is correct
46 Correct 13 ms 1152 KB Output is correct
47 Correct 9 ms 768 KB Output is correct
48 Correct 7 ms 640 KB Output is correct
49 Correct 10 ms 896 KB Output is correct
50 Correct 10 ms 896 KB Output is correct
51 Correct 6 ms 512 KB Output is correct
52 Correct 6 ms 640 KB Output is correct
53 Correct 13 ms 896 KB Output is correct
54 Correct 11 ms 768 KB Output is correct
55 Correct 5 ms 512 KB Output is correct
56 Correct 8 ms 640 KB Output is correct
57 Correct 9 ms 896 KB Output is correct
58 Correct 10 ms 896 KB Output is correct
59 Correct 10 ms 896 KB Output is correct
60 Correct 9 ms 768 KB Output is correct
61 Correct 5 ms 512 KB Output is correct
62 Correct 6 ms 640 KB Output is correct
63 Correct 9 ms 896 KB Output is correct
64 Correct 10 ms 896 KB Output is correct
65 Correct 11 ms 896 KB Output is correct
66 Correct 9 ms 768 KB Output is correct
67 Correct 6 ms 512 KB Output is correct
68 Correct 4 ms 256 KB Output is correct
69 Correct 4 ms 256 KB Output is correct
70 Correct 4 ms 256 KB Output is correct
71 Correct 5 ms 256 KB Output is correct
72 Correct 7 ms 640 KB Output is correct
73 Correct 8 ms 672 KB Output is correct
74 Correct 8 ms 768 KB Output is correct
75 Correct 8 ms 640 KB Output is correct
76 Correct 9 ms 640 KB Output is correct
77 Correct 9 ms 768 KB Output is correct
78 Correct 11 ms 896 KB Output is correct
79 Correct 11 ms 1024 KB Output is correct
80 Correct 13 ms 896 KB Output is correct
81 Correct 8 ms 640 KB Output is correct
82 Correct 6 ms 640 KB Output is correct
83 Correct 11 ms 768 KB Output is correct
84 Correct 9 ms 768 KB Output is correct
85 Correct 5 ms 512 KB Output is correct
86 Correct 7 ms 640 KB Output is correct
87 Correct 10 ms 896 KB Output is correct
88 Correct 5 ms 512 KB Output is correct
89 Correct 15 ms 1532 KB Output is correct
90 Correct 21 ms 2172 KB Output is correct
91 Correct 22 ms 2176 KB Output is correct
92 Correct 14 ms 1408 KB Output is correct
93 Correct 15 ms 1532 KB Output is correct
94 Correct 23 ms 2304 KB Output is correct
95 Correct 14 ms 1280 KB Output is correct
96 Correct 25 ms 2424 KB Output is correct
97 Correct 37 ms 3572 KB Output is correct
98 Correct 38 ms 3828 KB Output is correct
99 Correct 32 ms 3324 KB Output is correct
100 Correct 23 ms 2176 KB Output is correct
101 Correct 4 ms 256 KB Output is correct
102 Correct 5 ms 256 KB Output is correct
103 Correct 26 ms 2420 KB Output is correct
104 Correct 5 ms 256 KB Output is correct
105 Correct 7 ms 640 KB Output is correct
106 Correct 9 ms 768 KB Output is correct
107 Correct 7 ms 640 KB Output is correct
108 Correct 7 ms 640 KB Output is correct
109 Correct 15 ms 1532 KB Output is correct
110 Correct 16 ms 1532 KB Output is correct
111 Correct 23 ms 2428 KB Output is correct
112 Correct 4 ms 256 KB Output is correct
113 Correct 4 ms 256 KB Output is correct
114 Correct 33 ms 3572 KB Output is correct
115 Correct 5 ms 512 KB Output is correct
116 Correct 7 ms 640 KB Output is correct
117 Correct 19 ms 1792 KB Output is correct
118 Correct 19 ms 1916 KB Output is correct
119 Correct 37 ms 3828 KB Output is correct
120 Correct 38 ms 3824 KB Output is correct
121 Correct 43 ms 3828 KB Output is correct
122 Correct 39 ms 3828 KB Output is correct
123 Correct 23 ms 2428 KB Output is correct
124 Correct 36 ms 3492 KB Output is correct
125 Correct 36 ms 3828 KB Output is correct
126 Correct 38 ms 3828 KB Output is correct
127 Correct 33 ms 3572 KB Output is correct
128 Correct 21 ms 2176 KB Output is correct