Submission #198801

# Submission time Handle Problem Language Result Execution time Memory
198801 2020-01-27T18:22:24 Z Akashi Vision Program (IOI19_vision) C++14
100 / 100
98 ms 7472 KB
#include <bits/stdc++.h>
#include "vision.h"
 
using namespace std;
 
struct diags{
	int a, b, c;
};
 
int nr_right, nr_left;
diags right_diag[405], left_diag[405];

int check(int n, int m, int k){
	vector <int> v, v2;
	vector <int> pos;
	int left, right;
	
	///right diags
	for(int i = 1; i + k - 1 <= nr_right ; ++i){
		v.clear(); v2.clear();
		for(int j = i; j <= i + k - 1 ; ++j){
			v.push_back(right_diag[j].a);
			pos.push_back(right_diag[j].c);
		}
		
		int x = add_or(v);
		int y = add_xor(v);
	
		v.clear();
		v.push_back(x); v.push_back(add_not(y));
		pos.push_back(add_and(v));
	}
	right = add_or(pos);
	pos.clear();
	
	///left diags
	for(int i = 1; i + k - 1 <= nr_left ; ++i){
		v.clear(); v2.clear();
		for(int j = i; j <= i + k - 1 ; ++j){
			v.push_back(left_diag[j].a);
			pos.push_back(left_diag[j].c);
		}
		
		int x = add_or(v);
		int y = add_xor(v);
	
		v.clear();
		v.push_back(x); v.push_back(add_not(y));
		pos.push_back(add_and(v));
	}
	left = add_or(pos);
	
	
	v.clear();
	v.push_back(left); v.push_back(right);
	return add_and(v);
}

void construct_network(int n, int m, int k) {
	vector <int> v;
	int i, j;
	///right diags
	
	for(i = n - 1; i > 0 ; --i){
		int l = i, c = 0;
		v.clear();
		while(l < n && c < m){
			v.push_back(l * m + c);
			++l; ++c;
		}
		right_diag[++nr_right].a = add_or(v);
		right_diag[nr_right].b = add_xor(v);
	}
	
	for(j = 0; j < m ; ++j){
		int l = 0, c = j;
		v.clear();
		while(l < n && c < m){
			v.push_back(l * m + c);
			++l; ++c;
		}
		right_diag[++nr_right].a = add_or(v);
		right_diag[nr_right].b = add_xor(v);
	}
	
	for(int i = 1; i <= nr_right ; ++i){
		v.clear();
		v.push_back(right_diag[i].a);
		v.push_back(add_not(right_diag[i].b));
		right_diag[i].c = add_and(v);
	}
	
	///left diags
	
	for(i = n - 1; i > 0 ; --i){
		int l = i, c = m - 1;
		v.clear();
		while(l < n && c >= 0){
			v.push_back(l * m + c);
			++l; --c;
		}
		left_diag[++nr_left].a = add_or(v);
		left_diag[nr_left].b = add_xor(v);
	}
	
	for(j = m - 1; j >= 0 ; --j){
		int l = 0, c = j;
		v.clear();
		while(l < n && c >= 0){
			v.push_back(l * m + c);
			++l; --c;
		}
		left_diag[++nr_left].a = add_or(v);
		left_diag[nr_left].b = add_xor(v);
	}
	
	for(int i = 1; i <= nr_left ; ++i){
		v.clear();
		v.push_back(left_diag[i].a);
		v.push_back(add_not(left_diag[i].b));
		left_diag[i].c = add_and(v);
	}
		
	int ans1 = check(n, m, k + 1); 
	int ans2 = check(n, m, k);
	
	v.clear();
	v.push_back(add_not(ans2));
	v.push_back(ans1);
	add_and(v);

	return ;
}



# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 7 ms 504 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 7 ms 504 KB Output is correct
34 Correct 7 ms 508 KB Output is correct
35 Correct 7 ms 504 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 7 ms 504 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 7 ms 504 KB Output is correct
34 Correct 7 ms 508 KB Output is correct
35 Correct 7 ms 504 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
38 Correct 20 ms 1912 KB Output is correct
39 Correct 9 ms 632 KB Output is correct
40 Correct 8 ms 632 KB Output is correct
41 Correct 9 ms 760 KB Output is correct
42 Correct 8 ms 636 KB Output is correct
43 Correct 12 ms 1012 KB Output is correct
44 Correct 22 ms 1912 KB Output is correct
45 Correct 23 ms 2168 KB Output is correct
46 Correct 20 ms 1784 KB Output is correct
47 Correct 14 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 760 KB Output is correct
2 Correct 19 ms 1656 KB Output is correct
3 Correct 19 ms 1656 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 8 ms 760 KB Output is correct
6 Correct 18 ms 1528 KB Output is correct
7 Correct 19 ms 1528 KB Output is correct
8 Correct 7 ms 632 KB Output is correct
9 Correct 8 ms 764 KB Output is correct
10 Correct 18 ms 1400 KB Output is correct
11 Correct 21 ms 1656 KB Output is correct
12 Correct 19 ms 1656 KB Output is correct
13 Correct 16 ms 1400 KB Output is correct
14 Correct 7 ms 504 KB Output is correct
15 Correct 8 ms 760 KB Output is correct
16 Correct 16 ms 1400 KB Output is correct
17 Correct 19 ms 1656 KB Output is correct
18 Correct 20 ms 1656 KB Output is correct
19 Correct 19 ms 1400 KB Output is correct
20 Correct 7 ms 504 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 632 KB Output is correct
4 Correct 12 ms 1016 KB Output is correct
5 Correct 13 ms 1016 KB Output is correct
6 Correct 16 ms 888 KB Output is correct
7 Correct 7 ms 504 KB Output is correct
8 Correct 10 ms 884 KB Output is correct
9 Correct 17 ms 1400 KB Output is correct
10 Correct 20 ms 1656 KB Output is correct
11 Correct 17 ms 1400 KB Output is correct
12 Correct 9 ms 632 KB Output is correct
13 Correct 9 ms 760 KB Output is correct
14 Correct 17 ms 1528 KB Output is correct
15 Correct 17 ms 1400 KB Output is correct
16 Correct 6 ms 508 KB Output is correct
17 Correct 8 ms 760 KB Output is correct
18 Correct 18 ms 1784 KB Output is correct
19 Correct 6 ms 504 KB Output is correct
20 Correct 18 ms 1652 KB Output is correct
21 Correct 44 ms 4004 KB Output is correct
22 Correct 40 ms 3880 KB Output is correct
23 Correct 15 ms 1272 KB Output is correct
24 Correct 18 ms 1652 KB Output is correct
25 Correct 42 ms 4244 KB Output is correct
26 Correct 15 ms 1272 KB Output is correct
27 Correct 28 ms 2672 KB Output is correct
28 Correct 61 ms 6268 KB Output is correct
29 Correct 81 ms 7408 KB Output is correct
30 Correct 62 ms 6012 KB Output is correct
31 Correct 26 ms 2168 KB Output is correct
32 Correct 6 ms 256 KB Output is correct
33 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 2544 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 8 ms 632 KB Output is correct
4 Correct 10 ms 884 KB Output is correct
5 Correct 8 ms 760 KB Output is correct
6 Correct 8 ms 684 KB Output is correct
7 Correct 18 ms 1652 KB Output is correct
8 Correct 19 ms 1648 KB Output is correct
9 Correct 27 ms 2544 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 7 ms 504 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 7 ms 504 KB Output is correct
34 Correct 7 ms 508 KB Output is correct
35 Correct 7 ms 504 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
38 Correct 20 ms 1912 KB Output is correct
39 Correct 9 ms 632 KB Output is correct
40 Correct 8 ms 632 KB Output is correct
41 Correct 9 ms 760 KB Output is correct
42 Correct 8 ms 636 KB Output is correct
43 Correct 12 ms 1012 KB Output is correct
44 Correct 22 ms 1912 KB Output is correct
45 Correct 23 ms 2168 KB Output is correct
46 Correct 20 ms 1784 KB Output is correct
47 Correct 14 ms 1016 KB Output is correct
48 Correct 9 ms 760 KB Output is correct
49 Correct 19 ms 1656 KB Output is correct
50 Correct 19 ms 1656 KB Output is correct
51 Correct 6 ms 504 KB Output is correct
52 Correct 8 ms 760 KB Output is correct
53 Correct 18 ms 1528 KB Output is correct
54 Correct 19 ms 1528 KB Output is correct
55 Correct 7 ms 632 KB Output is correct
56 Correct 8 ms 764 KB Output is correct
57 Correct 18 ms 1400 KB Output is correct
58 Correct 21 ms 1656 KB Output is correct
59 Correct 19 ms 1656 KB Output is correct
60 Correct 16 ms 1400 KB Output is correct
61 Correct 7 ms 504 KB Output is correct
62 Correct 8 ms 760 KB Output is correct
63 Correct 16 ms 1400 KB Output is correct
64 Correct 19 ms 1656 KB Output is correct
65 Correct 20 ms 1656 KB Output is correct
66 Correct 19 ms 1400 KB Output is correct
67 Correct 7 ms 504 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 5 ms 376 KB Output is correct
70 Correct 5 ms 256 KB Output is correct
71 Correct 5 ms 256 KB Output is correct
72 Correct 8 ms 632 KB Output is correct
73 Correct 12 ms 1016 KB Output is correct
74 Correct 13 ms 1016 KB Output is correct
75 Correct 16 ms 888 KB Output is correct
76 Correct 7 ms 504 KB Output is correct
77 Correct 10 ms 884 KB Output is correct
78 Correct 17 ms 1400 KB Output is correct
79 Correct 20 ms 1656 KB Output is correct
80 Correct 17 ms 1400 KB Output is correct
81 Correct 9 ms 632 KB Output is correct
82 Correct 9 ms 760 KB Output is correct
83 Correct 17 ms 1528 KB Output is correct
84 Correct 17 ms 1400 KB Output is correct
85 Correct 6 ms 508 KB Output is correct
86 Correct 8 ms 760 KB Output is correct
87 Correct 18 ms 1784 KB Output is correct
88 Correct 6 ms 504 KB Output is correct
89 Correct 18 ms 1652 KB Output is correct
90 Correct 44 ms 4004 KB Output is correct
91 Correct 40 ms 3880 KB Output is correct
92 Correct 15 ms 1272 KB Output is correct
93 Correct 18 ms 1652 KB Output is correct
94 Correct 42 ms 4244 KB Output is correct
95 Correct 15 ms 1272 KB Output is correct
96 Correct 28 ms 2672 KB Output is correct
97 Correct 61 ms 6268 KB Output is correct
98 Correct 81 ms 7408 KB Output is correct
99 Correct 62 ms 6012 KB Output is correct
100 Correct 26 ms 2168 KB Output is correct
101 Correct 6 ms 256 KB Output is correct
102 Correct 5 ms 256 KB Output is correct
103 Correct 28 ms 2544 KB Output is correct
104 Correct 6 ms 376 KB Output is correct
105 Correct 8 ms 632 KB Output is correct
106 Correct 10 ms 884 KB Output is correct
107 Correct 8 ms 760 KB Output is correct
108 Correct 8 ms 684 KB Output is correct
109 Correct 18 ms 1652 KB Output is correct
110 Correct 19 ms 1648 KB Output is correct
111 Correct 27 ms 2544 KB Output is correct
112 Correct 5 ms 256 KB Output is correct
113 Correct 5 ms 256 KB Output is correct
114 Correct 63 ms 6268 KB Output is correct
115 Correct 7 ms 504 KB Output is correct
116 Correct 8 ms 760 KB Output is correct
117 Correct 32 ms 2808 KB Output is correct
118 Correct 33 ms 3188 KB Output is correct
119 Correct 74 ms 7352 KB Output is correct
120 Correct 98 ms 7352 KB Output is correct
121 Correct 79 ms 7472 KB Output is correct
122 Correct 74 ms 7340 KB Output is correct
123 Correct 28 ms 2544 KB Output is correct
124 Correct 63 ms 6268 KB Output is correct
125 Correct 77 ms 7344 KB Output is correct
126 Correct 74 ms 7472 KB Output is correct
127 Correct 62 ms 6012 KB Output is correct
128 Correct 23 ms 2168 KB Output is correct