Submission #163350

# Submission time Handle Problem Language Result Execution time Memory
163350 2019-11-12T18:39:57 Z farmerboy Vision Program (IOI19_vision) C++14
59 / 100
32 ms 2676 KB
#include <bits/stdc++.h>
#include "vision.h"

using namespace std;

vector<int> checkBlock(vector<int> &a, vector<int> &b, int K) {
	vector<int> res;
	for (int i = K-1; i < int(a.size()); i++) {
		vector<int> g, h;
		for (int j = i - K + 1; j <= i; j++) {
			h.emplace_back(b[j]);
			g.emplace_back(a[j]);
		}
		res.emplace_back(add_and({ add_or(g), add_or({ add_or(h), add_and({ add_not(add_or(h)), add_not(add_xor(g)) }) }) }));
	}
	return res;
}

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

	vector<int> lefDi1, rigDi1;
	vector<int> lefDi2, rigDi2;

	// step 1 + 2: right diagonal
	for (int i = H-1; i >= 0; i--) {
		vector<int> a;
		for (int x = i, y = 0; x < H && y < W; x++, y++) a.emplace_back(x * W + y);
		int g = add_or(a);
		rigDi1.emplace_back(g);
		rigDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}
	for (int i = 1; i < W; i++) {
		vector<int> a;
		for (int x = 0, y = i; x < H && y < W; x++, y++) a.emplace_back(x * W + y);
		int g = add_or(a);
		rigDi1.emplace_back(g);
		rigDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}

	// step 1 + 2: left diagonal
	for (int i = 0; i < W; i++) {
		vector<int> a;
		for (int x = 0, y = i; x < H && y >= 0; x++, y--) a.emplace_back(x * W + y);
		int g = add_or(a);
		lefDi1.emplace_back(g);
		lefDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}
	for (int i = 1; i < H; i++) {
		vector<int> a;
		for (int x = i, y = W-1; x < H && y >= 0; x++, y--) a.emplace_back(x * W + y);
		int g = add_or(a);
		lefDi1.emplace_back(g);
		lefDi2.emplace_back( add_and( {add_not(add_xor(a)), g} ) );
	}

	// step 3-4-5:
	int g = add_and({ add_or(checkBlock(lefDi1, lefDi2, K+1)), add_or(checkBlock(rigDi1, rigDi2, K+1)) });

	// cout << g << endl;

	// step 6:
	int h = add_and({ add_or(checkBlock(lefDi1, lefDi2, K)), add_or(checkBlock(rigDi1, rigDi2, K)) });

	// cout << h << endl;

	// step 7:
	add_and({ g, add_not(h) });
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 5 ms 632 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 380 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 3 ms 504 KB Output is correct
33 Correct 4 ms 612 KB Output is correct
34 Correct 5 ms 632 KB Output is correct
35 Correct 5 ms 504 KB Output is correct
36 Correct 4 ms 504 KB Output is correct
37 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 5 ms 632 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 380 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 3 ms 504 KB Output is correct
33 Correct 4 ms 612 KB Output is correct
34 Correct 5 ms 632 KB Output is correct
35 Correct 5 ms 504 KB Output is correct
36 Correct 4 ms 504 KB Output is correct
37 Correct 3 ms 504 KB Output is correct
38 Correct 22 ms 2292 KB Output is correct
39 Correct 7 ms 888 KB Output is correct
40 Correct 6 ms 632 KB Output is correct
41 Correct 8 ms 1012 KB Output is correct
42 Correct 6 ms 636 KB Output is correct
43 Correct 11 ms 1364 KB Output is correct
44 Correct 22 ms 2420 KB Output is correct
45 Correct 25 ms 2676 KB Output is correct
46 Correct 20 ms 2168 KB Output is correct
47 Correct 7 ms 764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1140 KB Output is correct
2 Correct 20 ms 2052 KB Output is correct
3 Correct 20 ms 2036 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 7 ms 1140 KB Output is correct
6 Correct 32 ms 2036 KB Output is correct
7 Correct 18 ms 1784 KB Output is correct
8 Correct 4 ms 504 KB Output is correct
9 Correct 7 ms 1140 KB Output is correct
10 Correct 18 ms 1780 KB Output is correct
11 Correct 23 ms 2036 KB Output is correct
12 Correct 20 ms 2036 KB Output is correct
13 Correct 16 ms 1656 KB Output is correct
14 Correct 3 ms 504 KB Output is correct
15 Correct 7 ms 1144 KB Output is correct
16 Correct 17 ms 1780 KB Output is correct
17 Correct 20 ms 2036 KB Output is correct
18 Correct 20 ms 2036 KB Output is correct
19 Correct 15 ms 1656 KB Output is correct
20 Correct 3 ms 504 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 6 ms 1060 KB Output is correct
4 Correct 20 ms 1268 KB Output is correct
5 Correct 22 ms 1272 KB Output is correct
6 Correct 9 ms 1144 KB Output is correct
7 Correct 4 ms 504 KB Output is correct
8 Correct 9 ms 1268 KB Output is correct
9 Correct 17 ms 1780 KB Output is correct
10 Correct 19 ms 2164 KB Output is correct
11 Correct 16 ms 1656 KB Output is correct
12 Correct 5 ms 632 KB Output is correct
13 Correct 7 ms 1140 KB Output is correct
14 Correct 18 ms 1908 KB Output is correct
15 Correct 17 ms 1784 KB Output is correct
16 Correct 3 ms 504 KB Output is correct
17 Correct 7 ms 1140 KB Output is correct
18 Correct 20 ms 2164 KB Output is correct
19 Correct 3 ms 504 KB Output is correct
20 Incorrect 5 ms 1396 KB WA in grader: Too many instructions
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1652 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 5 ms 632 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 380 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 3 ms 504 KB Output is correct
33 Correct 4 ms 612 KB Output is correct
34 Correct 5 ms 632 KB Output is correct
35 Correct 5 ms 504 KB Output is correct
36 Correct 4 ms 504 KB Output is correct
37 Correct 3 ms 504 KB Output is correct
38 Correct 22 ms 2292 KB Output is correct
39 Correct 7 ms 888 KB Output is correct
40 Correct 6 ms 632 KB Output is correct
41 Correct 8 ms 1012 KB Output is correct
42 Correct 6 ms 636 KB Output is correct
43 Correct 11 ms 1364 KB Output is correct
44 Correct 22 ms 2420 KB Output is correct
45 Correct 25 ms 2676 KB Output is correct
46 Correct 20 ms 2168 KB Output is correct
47 Correct 7 ms 764 KB Output is correct
48 Correct 7 ms 1140 KB Output is correct
49 Correct 20 ms 2052 KB Output is correct
50 Correct 20 ms 2036 KB Output is correct
51 Correct 3 ms 504 KB Output is correct
52 Correct 7 ms 1140 KB Output is correct
53 Correct 32 ms 2036 KB Output is correct
54 Correct 18 ms 1784 KB Output is correct
55 Correct 4 ms 504 KB Output is correct
56 Correct 7 ms 1140 KB Output is correct
57 Correct 18 ms 1780 KB Output is correct
58 Correct 23 ms 2036 KB Output is correct
59 Correct 20 ms 2036 KB Output is correct
60 Correct 16 ms 1656 KB Output is correct
61 Correct 3 ms 504 KB Output is correct
62 Correct 7 ms 1144 KB Output is correct
63 Correct 17 ms 1780 KB Output is correct
64 Correct 20 ms 2036 KB Output is correct
65 Correct 20 ms 2036 KB Output is correct
66 Correct 15 ms 1656 KB Output is correct
67 Correct 3 ms 504 KB Output is correct
68 Correct 2 ms 376 KB Output is correct
69 Correct 2 ms 356 KB Output is correct
70 Correct 2 ms 376 KB Output is correct
71 Correct 2 ms 376 KB Output is correct
72 Correct 6 ms 1060 KB Output is correct
73 Correct 20 ms 1268 KB Output is correct
74 Correct 22 ms 1272 KB Output is correct
75 Correct 9 ms 1144 KB Output is correct
76 Correct 4 ms 504 KB Output is correct
77 Correct 9 ms 1268 KB Output is correct
78 Correct 17 ms 1780 KB Output is correct
79 Correct 19 ms 2164 KB Output is correct
80 Correct 16 ms 1656 KB Output is correct
81 Correct 5 ms 632 KB Output is correct
82 Correct 7 ms 1140 KB Output is correct
83 Correct 18 ms 1908 KB Output is correct
84 Correct 17 ms 1784 KB Output is correct
85 Correct 3 ms 504 KB Output is correct
86 Correct 7 ms 1140 KB Output is correct
87 Correct 20 ms 2164 KB Output is correct
88 Correct 3 ms 504 KB Output is correct
89 Incorrect 5 ms 1396 KB WA in grader: Too many instructions
90 Halted 0 ms 0 KB -