Submission #558869

# Submission time Handle Problem Language Result Execution time Memory
558869 2022-05-08T20:45:59 Z mosiashvililuka Vision Program (IOI19_vision) C++14
100 / 100
44 ms 4384 KB
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,K,prX[409],sfX[409],prY[409],sfY[409],nag;
vector <int> X[409],Y[409],V,vv,Z,x,y;
int ID(int q, int w){
	return q*b+w;
}
void construct_network(int HH, int WW, int KK) {
	c=add_not(0);d=add_not(c);
	vv.clear();vv.push_back(c);vv.push_back(d);
	nag=add_and(vv);
	a=HH;b=WW;K=KK;
	for(i=0; i<=402; i++){
		X[i].clear();Y[i].clear();V.clear();vv.clear();
		prX[i]=sfX[i]=nag;prY[i]=sfY[i]=nag;
	}
	for(i=0; i<a; i++){
		for(j=0; j<b; j++){
			ii=i+j;jj=i-j+b;
			X[ii].push_back(ID(i,j));
			Y[jj].push_back(ID(i,j));
		}
	}
	for(i=0; i<=400; i++){
		j=i+K;if(j>400) break;
		if(X[i].size()==0||X[j].size()==0) continue;
		c=add_or(X[i]);d=add_or(X[j]);
		vv.clear();vv.push_back(c);vv.push_back(d);
		e=add_and(vv);
		V.push_back(e);
	}
	for(i=0; i<=400; i++){
		j=i+K;if(j>400) break;
		if(Y[i].size()==0||Y[j].size()==0) continue;
		c=add_or(Y[i]);d=add_or(Y[j]);
		vv.clear();vv.push_back(c);vv.push_back(d);
		e=add_and(vv);
		V.push_back(e);
	}
	if(V.size()==0) return;
	//
	for(i=0; i<=400; i++){
		x.clear();
		for(jj=0; jj<X[i].size(); jj++){
			x.push_back(X[i][jj]);
		}
		if(x.size()==0){
			if(i!=0) prX[i]=prX[i-1];
		}else{
			e=add_or(x);
			if(i!=0){
				vv.clear();vv.push_back(e);vv.push_back(prX[i-1]);
				prX[i]=add_or(vv);
			}else{
				prX[i]=e;
			}
		}
		
		x.clear();
		for(jj=0; jj<Y[i].size(); jj++){
			x.push_back(Y[i][jj]);
		}
		if(x.size()==0){
			if(i!=0) prY[i]=prY[i-1];
		}else{
			e=add_or(x);
			if(i!=0){
				vv.clear();vv.push_back(e);vv.push_back(prY[i-1]);
				prY[i]=add_or(vv);
			}else{
				prY[i]=e;
			}
		}
	}
	for(i=400; i>=0; i--){
		x.clear();
		for(jj=0; jj<X[i].size(); jj++){
			x.push_back(X[i][jj]);
		}
		if(x.size()==0){
			if(i!=400) sfX[i]=sfX[i+1];
		}else{
			e=add_or(x);
			if(i!=400){
				vv.clear();vv.push_back(e);vv.push_back(sfX[i+1]);
				sfX[i]=add_or(vv);
			}else{
				sfX[i]=e;
			}
		}
		
		x.clear();
		for(jj=0; jj<Y[i].size(); jj++){
			x.push_back(Y[i][jj]);
		}
		if(x.size()==0){
			if(i!=400) sfY[i]=sfY[i+1];
		}else{
			e=add_or(x);
			if(i!=400){
				vv.clear();vv.push_back(e);vv.push_back(sfY[i+1]);
				sfY[i]=add_or(vv);
			}else{
				sfY[i]=e;
			}
		}
	}
	//
	for(i=0; i<=400; i++){
		j=i+K+1;if(j>400) break;
		c=prX[i];d=sfX[j];
		vv.clear();vv.push_back(c);vv.push_back(d);
		e=add_and(vv);e=add_not(e);
		Z.push_back(e);
	}
	for(i=0; i<=400; i++){
		j=i+K+1;if(j>400) break;
		c=prY[i];d=sfY[j];
		vv.clear();vv.push_back(c);vv.push_back(d);
		e=add_and(vv);e=add_not(e);
		Z.push_back(e);
	}
	if(Z.size()!=0){
		c=add_and(Z);d=add_or(V);
		vv.clear();vv.push_back(c);vv.push_back(d);
		add_and(vv);
	}else{
		add_or(V);
	}
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:45:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   for(jj=0; jj<X[i].size(); jj++){
      |             ~~^~~~~~~~~~~~
vision.cpp:61:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |   for(jj=0; jj<Y[i].size(); jj++){
      |             ~~^~~~~~~~~~~~
vision.cpp:78:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |   for(jj=0; jj<X[i].size(); jj++){
      |             ~~^~~~~~~~~~~~
vision.cpp:94:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   94 |   for(jj=0; jj<Y[i].size(); jj++){
      |             ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 1 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 1 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 1 ms 468 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 2 ms 596 KB Output is correct
33 Correct 2 ms 596 KB Output is correct
34 Correct 2 ms 596 KB Output is correct
35 Correct 2 ms 596 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 1 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 1 ms 468 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 2 ms 596 KB Output is correct
33 Correct 2 ms 596 KB Output is correct
34 Correct 2 ms 596 KB Output is correct
35 Correct 2 ms 596 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 10 ms 1376 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 6 ms 944 KB Output is correct
42 Correct 5 ms 724 KB Output is correct
43 Correct 10 ms 1416 KB Output is correct
44 Correct 12 ms 1364 KB Output is correct
45 Correct 9 ms 1236 KB Output is correct
46 Correct 8 ms 980 KB Output is correct
47 Correct 5 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 2 ms 548 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 3 ms 724 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 724 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 2 ms 724 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 2 ms 596 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 2 ms 596 KB Output is correct
14 Correct 2 ms 468 KB Output is correct
15 Correct 2 ms 724 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 4 ms 804 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 3 ms 724 KB Output is correct
6 Correct 3 ms 704 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 6 ms 1108 KB Output is correct
9 Correct 6 ms 980 KB Output is correct
10 Correct 6 ms 852 KB Output is correct
11 Correct 4 ms 852 KB Output is correct
12 Correct 4 ms 724 KB Output is correct
13 Correct 3 ms 724 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 2 ms 596 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 2 ms 724 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 20 ms 2420 KB Output is correct
21 Correct 16 ms 2196 KB Output is correct
22 Correct 12 ms 1748 KB Output is correct
23 Correct 10 ms 1472 KB Output is correct
24 Correct 18 ms 2384 KB Output is correct
25 Correct 21 ms 1856 KB Output is correct
26 Correct 9 ms 1492 KB Output is correct
27 Correct 44 ms 4292 KB Output is correct
28 Correct 30 ms 4048 KB Output is correct
29 Correct 26 ms 3472 KB Output is correct
30 Correct 21 ms 2784 KB Output is correct
31 Correct 19 ms 2544 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 4296 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 5 ms 724 KB Output is correct
4 Correct 6 ms 1108 KB Output is correct
5 Correct 3 ms 724 KB Output is correct
6 Correct 3 ms 724 KB Output is correct
7 Correct 26 ms 2400 KB Output is correct
8 Correct 20 ms 2384 KB Output is correct
9 Correct 32 ms 4384 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 1 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 1 ms 468 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 2 ms 596 KB Output is correct
33 Correct 2 ms 596 KB Output is correct
34 Correct 2 ms 596 KB Output is correct
35 Correct 2 ms 596 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 10 ms 1376 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 6 ms 944 KB Output is correct
42 Correct 5 ms 724 KB Output is correct
43 Correct 10 ms 1416 KB Output is correct
44 Correct 12 ms 1364 KB Output is correct
45 Correct 9 ms 1236 KB Output is correct
46 Correct 8 ms 980 KB Output is correct
47 Correct 5 ms 980 KB Output is correct
48 Correct 2 ms 724 KB Output is correct
49 Correct 2 ms 548 KB Output is correct
50 Correct 3 ms 596 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 3 ms 724 KB Output is correct
53 Correct 2 ms 596 KB Output is correct
54 Correct 2 ms 724 KB Output is correct
55 Correct 1 ms 468 KB Output is correct
56 Correct 2 ms 724 KB Output is correct
57 Correct 2 ms 596 KB Output is correct
58 Correct 2 ms 596 KB Output is correct
59 Correct 2 ms 596 KB Output is correct
60 Correct 2 ms 596 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 2 ms 724 KB Output is correct
63 Correct 2 ms 596 KB Output is correct
64 Correct 2 ms 596 KB Output is correct
65 Correct 2 ms 596 KB Output is correct
66 Correct 2 ms 596 KB Output is correct
67 Correct 3 ms 468 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 340 KB Output is correct
72 Correct 4 ms 804 KB Output is correct
73 Correct 4 ms 724 KB Output is correct
74 Correct 3 ms 724 KB Output is correct
75 Correct 3 ms 704 KB Output is correct
76 Correct 3 ms 596 KB Output is correct
77 Correct 6 ms 1108 KB Output is correct
78 Correct 6 ms 980 KB Output is correct
79 Correct 6 ms 852 KB Output is correct
80 Correct 4 ms 852 KB Output is correct
81 Correct 4 ms 724 KB Output is correct
82 Correct 3 ms 724 KB Output is correct
83 Correct 2 ms 596 KB Output is correct
84 Correct 2 ms 596 KB Output is correct
85 Correct 2 ms 468 KB Output is correct
86 Correct 2 ms 724 KB Output is correct
87 Correct 2 ms 596 KB Output is correct
88 Correct 2 ms 468 KB Output is correct
89 Correct 20 ms 2420 KB Output is correct
90 Correct 16 ms 2196 KB Output is correct
91 Correct 12 ms 1748 KB Output is correct
92 Correct 10 ms 1472 KB Output is correct
93 Correct 18 ms 2384 KB Output is correct
94 Correct 21 ms 1856 KB Output is correct
95 Correct 9 ms 1492 KB Output is correct
96 Correct 44 ms 4292 KB Output is correct
97 Correct 30 ms 4048 KB Output is correct
98 Correct 26 ms 3472 KB Output is correct
99 Correct 21 ms 2784 KB Output is correct
100 Correct 19 ms 2544 KB Output is correct
101 Correct 2 ms 340 KB Output is correct
102 Correct 1 ms 340 KB Output is correct
103 Correct 32 ms 4296 KB Output is correct
104 Correct 1 ms 348 KB Output is correct
105 Correct 5 ms 724 KB Output is correct
106 Correct 6 ms 1108 KB Output is correct
107 Correct 3 ms 724 KB Output is correct
108 Correct 3 ms 724 KB Output is correct
109 Correct 26 ms 2400 KB Output is correct
110 Correct 20 ms 2384 KB Output is correct
111 Correct 32 ms 4384 KB Output is correct
112 Correct 1 ms 340 KB Output is correct
113 Correct 1 ms 340 KB Output is correct
114 Correct 31 ms 4112 KB Output is correct
115 Correct 2 ms 468 KB Output is correct
116 Correct 2 ms 724 KB Output is correct
117 Correct 11 ms 1560 KB Output is correct
118 Correct 17 ms 2384 KB Output is correct
119 Correct 24 ms 3360 KB Output is correct
120 Correct 27 ms 3432 KB Output is correct
121 Correct 27 ms 3432 KB Output is correct
122 Correct 27 ms 3416 KB Output is correct
123 Correct 35 ms 4304 KB Output is correct
124 Correct 32 ms 4068 KB Output is correct
125 Correct 29 ms 3476 KB Output is correct
126 Correct 24 ms 3408 KB Output is correct
127 Correct 20 ms 2768 KB Output is correct
128 Correct 22 ms 2508 KB Output is correct