Submission #416439

# Submission time Handle Problem Language Result Execution time Memory
416439 2021-06-02T11:45:01 Z Bill_00 Vision Program (IOI19_vision) C++14
100 / 100
63 ms 3996 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K){
	vector<int>y;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			y.push_back(i*W+j);
		}
	}
	int r=add_xor(y);
	vector<int>id,id1,u,v;
	for(int i=0;i<H;i++){
		vector<int>row;
		for(int j=0;j<W;j++){
			row.push_back(i*W+j);
		}
		u.push_back(add_or(row));
	}
	for(int j=0;j<W;j++){
		vector<int>column;
		for(int i=0;i<H;i++){
			column.push_back(i*W+j);
		}
		v.push_back(add_or(column));
	}
	for(int i=0;i<H-K-1;i++){
		vector<int>row1,row2;
		for(int j=0;j<=i;j++){
			row1.push_back(u[j]);
		}
		for(int j=i+K+1;j<H;j++){
			row2.push_back(u[j]);
		}
		int a=add_or(row1);
		int b=add_or(row2);
		id.push_back(add_and({a,b}));
	}
	for(int i=0;i<W-K-1;i++){
		vector<int>row1,row2;
		for(int j=0;j<=i;j++){
			row1.push_back(v[j]);
		}
		for(int j=i+K+1;j<W;j++){
			row2.push_back(v[j]);
		}
		int a=add_or(row1);
		int b=add_or(row2);
		id.push_back(add_and({a,b}));
	}
	for(int i=0;i<K;i++){
		for(int j=i;j<=(H+W-2-K);j+=K){
			vector<int>v,u;
			for(int k=j;k>=0;k--){
				if(k<H && (j-k)<W){
					v.push_back(k*W+j-k);
				}
			}
			for(int k=j+K;k>=0;k--){
				if(k<H && (j-k+K)<W){
					u.push_back(k*W+j-k+K);
				}
			}
			int a,b;
			if(u.size()) a=add_or(u);
			else continue;
			if(v.size()) b=add_or(v);
			else continue;
			id1.push_back(add_and({a,b}));
		}
	}
	for(int i=0;i<K;i++){
		for(int j=i;j<=(H+W-2-K);j+=K){
			vector<int>v,u;
			for(int k=j;k>=0;k--){
				if(k<H && (W-j+k-1)>=0){
					v.push_back(k*W+W-j+k-1);
				}
			}
			for(int k=j+K;k>=0;k--){
				if(k<H && (W-j-K+k-1)>=0){
					u.push_back(k*W+W-j+k-K-1);
				}
			}
			int a,b;
			if(u.size()) a=add_or(u);
			else continue;
			if(v.size()) b=add_or(v);
			else continue;
			id1.push_back(add_and({a,b}));
		}
	}
	int a,b;
	if(id.size()!=0){
		a=add_or(id);
		a=add_not(a);
		if(id1.size()!=0){
			int b=add_or(id1);
			add_and({a,b});
		}	
		else{
			add_or({r});
		}
	} 
	else{
		if(id1.size()!=0){
			add_or(id1);
		}
		else add_or({r});
	}
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:93:8: warning: unused variable 'b' [-Wunused-variable]
   93 |  int a,b;
      |        ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 9 ms 972 KB Output is correct
39 Correct 2 ms 332 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 7 ms 716 KB Output is correct
42 Correct 2 ms 332 KB Output is correct
43 Correct 12 ms 1176 KB Output is correct
44 Correct 11 ms 996 KB Output is correct
45 Correct 7 ms 716 KB Output is correct
46 Correct 5 ms 636 KB Output is correct
47 Correct 4 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 840 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 2 ms 460 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 6 ms 716 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 7 ms 716 KB Output is correct
10 Correct 4 ms 588 KB Output is correct
11 Correct 2 ms 460 KB Output is correct
12 Correct 2 ms 460 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 6 ms 716 KB Output is correct
16 Correct 4 ms 588 KB Output is correct
17 Correct 2 ms 460 KB Output is correct
18 Correct 2 ms 460 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 5 ms 588 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 9 ms 972 KB Output is correct
9 Correct 7 ms 716 KB Output is correct
10 Correct 5 ms 588 KB Output is correct
11 Correct 3 ms 460 KB Output is correct
12 Correct 3 ms 460 KB Output is correct
13 Correct 6 ms 696 KB Output is correct
14 Correct 5 ms 460 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 6 ms 716 KB Output is correct
18 Correct 2 ms 460 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 26 ms 2300 KB Output is correct
21 Correct 16 ms 1576 KB Output is correct
22 Correct 10 ms 1116 KB Output is correct
23 Correct 11 ms 892 KB Output is correct
24 Correct 28 ms 2220 KB Output is correct
25 Correct 17 ms 1328 KB Output is correct
26 Correct 7 ms 800 KB Output is correct
27 Correct 61 ms 3996 KB Output is correct
28 Correct 35 ms 3200 KB Output is correct
29 Correct 41 ms 2336 KB Output is correct
30 Correct 20 ms 1708 KB Output is correct
31 Correct 15 ms 1416 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 3984 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 5 ms 588 KB Output is correct
4 Correct 10 ms 972 KB Output is correct
5 Correct 6 ms 716 KB Output is correct
6 Correct 7 ms 700 KB Output is correct
7 Correct 24 ms 2300 KB Output is correct
8 Correct 24 ms 2292 KB Output is correct
9 Correct 45 ms 3980 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 2 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 9 ms 972 KB Output is correct
39 Correct 2 ms 332 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 7 ms 716 KB Output is correct
42 Correct 2 ms 332 KB Output is correct
43 Correct 12 ms 1176 KB Output is correct
44 Correct 11 ms 996 KB Output is correct
45 Correct 7 ms 716 KB Output is correct
46 Correct 5 ms 636 KB Output is correct
47 Correct 4 ms 496 KB Output is correct
48 Correct 7 ms 840 KB Output is correct
49 Correct 2 ms 460 KB Output is correct
50 Correct 2 ms 460 KB Output is correct
51 Correct 1 ms 204 KB Output is correct
52 Correct 6 ms 716 KB Output is correct
53 Correct 3 ms 460 KB Output is correct
54 Correct 2 ms 332 KB Output is correct
55 Correct 1 ms 204 KB Output is correct
56 Correct 7 ms 716 KB Output is correct
57 Correct 4 ms 588 KB Output is correct
58 Correct 2 ms 460 KB Output is correct
59 Correct 2 ms 460 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 1 ms 204 KB Output is correct
62 Correct 6 ms 716 KB Output is correct
63 Correct 4 ms 588 KB Output is correct
64 Correct 2 ms 460 KB Output is correct
65 Correct 2 ms 460 KB Output is correct
66 Correct 1 ms 332 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 0 ms 204 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 1 ms 204 KB Output is correct
71 Correct 1 ms 204 KB Output is correct
72 Correct 5 ms 588 KB Output is correct
73 Correct 4 ms 460 KB Output is correct
74 Correct 3 ms 460 KB Output is correct
75 Correct 2 ms 332 KB Output is correct
76 Correct 2 ms 332 KB Output is correct
77 Correct 9 ms 972 KB Output is correct
78 Correct 7 ms 716 KB Output is correct
79 Correct 5 ms 588 KB Output is correct
80 Correct 3 ms 460 KB Output is correct
81 Correct 3 ms 460 KB Output is correct
82 Correct 6 ms 696 KB Output is correct
83 Correct 5 ms 460 KB Output is correct
84 Correct 1 ms 332 KB Output is correct
85 Correct 1 ms 204 KB Output is correct
86 Correct 6 ms 716 KB Output is correct
87 Correct 2 ms 460 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 26 ms 2300 KB Output is correct
90 Correct 16 ms 1576 KB Output is correct
91 Correct 10 ms 1116 KB Output is correct
92 Correct 11 ms 892 KB Output is correct
93 Correct 28 ms 2220 KB Output is correct
94 Correct 17 ms 1328 KB Output is correct
95 Correct 7 ms 800 KB Output is correct
96 Correct 61 ms 3996 KB Output is correct
97 Correct 35 ms 3200 KB Output is correct
98 Correct 41 ms 2336 KB Output is correct
99 Correct 20 ms 1708 KB Output is correct
100 Correct 15 ms 1416 KB Output is correct
101 Correct 1 ms 204 KB Output is correct
102 Correct 1 ms 204 KB Output is correct
103 Correct 46 ms 3984 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 5 ms 588 KB Output is correct
106 Correct 10 ms 972 KB Output is correct
107 Correct 6 ms 716 KB Output is correct
108 Correct 7 ms 700 KB Output is correct
109 Correct 24 ms 2300 KB Output is correct
110 Correct 24 ms 2292 KB Output is correct
111 Correct 45 ms 3980 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 1 ms 256 KB Output is correct
114 Correct 39 ms 3076 KB Output is correct
115 Correct 1 ms 204 KB Output is correct
116 Correct 7 ms 744 KB Output is correct
117 Correct 8 ms 892 KB Output is correct
118 Correct 25 ms 1880 KB Output is correct
119 Correct 28 ms 2272 KB Output is correct
120 Correct 30 ms 2252 KB Output is correct
121 Correct 24 ms 2248 KB Output is correct
122 Correct 26 ms 2336 KB Output is correct
123 Correct 63 ms 3980 KB Output is correct
124 Correct 52 ms 3088 KB Output is correct
125 Correct 29 ms 2340 KB Output is correct
126 Correct 24 ms 2384 KB Output is correct
127 Correct 19 ms 1636 KB Output is correct
128 Correct 15 ms 1436 KB Output is correct