Submission #558868

# Submission time Handle Problem Language Result Execution time Memory
558868 2022-05-08T20:44:42 Z mosiashvililuka Vision Program (IOI19_vision) C++14
100 / 100
34 ms 4388 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;
		/*x.clear();y.clear();
		for(ii=0; ii<=i; ii++){
			for(jj=0; jj<X[ii].size(); jj++){
				x.push_back(X[ii][jj]);
			}
		}
		for(ii=j; ii<=400; ii++){
			for(jj=0; jj<X[ii].size(); jj++){
				y.push_back(X[ii][jj]);
			}
		}
		if(x.size()==0||y.size()==0) continue;
		c=add_or(x);d=add_or(y);*/
		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;
		/*x.clear();y.clear();
		for(ii=0; ii<=i; ii++){
			for(jj=0; jj<Y[ii].size(); jj++){
				x.push_back(Y[ii][jj]);
			}
		}
		for(ii=j; ii<=400; ii++){
			for(jj=0; jj<Y[ii].size(); jj++){
				y.push_back(Y[ii][jj]);
			}
		}
		if(x.size()==0||y.size()==0) continue;
		c=add_or(x);d=add_or(y);*/
		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 1 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 1 ms 468 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 1 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 1 ms 468 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 340 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 1 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 1 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 1 ms 468 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 340 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 1 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 1 ms 468 KB Output is correct
31 Correct 1 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 1 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 1 ms 468 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 340 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 1 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 1 ms 468 KB Output is correct
31 Correct 1 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 1336 KB Output is correct
39 Correct 2 ms 596 KB Output is correct
40 Correct 2 ms 456 KB Output is correct
41 Correct 6 ms 964 KB Output is correct
42 Correct 3 ms 716 KB Output is correct
43 Correct 10 ms 1468 KB Output is correct
44 Correct 9 ms 1364 KB Output is correct
45 Correct 8 ms 1160 KB Output is correct
46 Correct 6 ms 980 KB Output is correct
47 Correct 6 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 3 ms 596 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 724 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 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 1 ms 468 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 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 724 KB Output is correct
4 Correct 3 ms 724 KB Output is correct
5 Correct 4 ms 724 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 7 ms 1108 KB Output is correct
9 Correct 6 ms 1052 KB Output is correct
10 Correct 6 ms 980 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 3 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 524 KB Output is correct
19 Correct 2 ms 580 KB Output is correct
20 Correct 17 ms 2384 KB Output is correct
21 Correct 17 ms 2128 KB Output is correct
22 Correct 12 ms 1712 KB Output is correct
23 Correct 10 ms 1492 KB Output is correct
24 Correct 17 ms 2480 KB Output is correct
25 Correct 13 ms 1896 KB Output is correct
26 Correct 9 ms 1448 KB Output is correct
27 Correct 34 ms 4388 KB Output is correct
28 Correct 32 ms 4144 KB Output is correct
29 Correct 24 ms 3408 KB Output is correct
30 Correct 19 ms 2768 KB Output is correct
31 Correct 17 ms 2496 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 4292 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 4 ms 724 KB Output is correct
4 Correct 6 ms 1108 KB Output is correct
5 Correct 3 ms 712 KB Output is correct
6 Correct 2 ms 724 KB Output is correct
7 Correct 17 ms 2368 KB Output is correct
8 Correct 17 ms 2428 KB Output is correct
9 Correct 32 ms 4332 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 1 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 1 ms 468 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 340 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 1 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 1 ms 468 KB Output is correct
31 Correct 1 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 1336 KB Output is correct
39 Correct 2 ms 596 KB Output is correct
40 Correct 2 ms 456 KB Output is correct
41 Correct 6 ms 964 KB Output is correct
42 Correct 3 ms 716 KB Output is correct
43 Correct 10 ms 1468 KB Output is correct
44 Correct 9 ms 1364 KB Output is correct
45 Correct 8 ms 1160 KB Output is correct
46 Correct 6 ms 980 KB Output is correct
47 Correct 6 ms 1016 KB Output is correct
48 Correct 2 ms 724 KB Output is correct
49 Correct 3 ms 596 KB Output is correct
50 Correct 2 ms 596 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 2 ms 724 KB Output is correct
53 Correct 2 ms 596 KB Output is correct
54 Correct 2 ms 596 KB Output is correct
55 Correct 2 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 1 ms 468 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 2 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 724 KB Output is correct
73 Correct 3 ms 724 KB Output is correct
74 Correct 4 ms 724 KB Output is correct
75 Correct 3 ms 596 KB Output is correct
76 Correct 2 ms 596 KB Output is correct
77 Correct 7 ms 1108 KB Output is correct
78 Correct 6 ms 1052 KB Output is correct
79 Correct 6 ms 980 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 3 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 524 KB Output is correct
88 Correct 2 ms 580 KB Output is correct
89 Correct 17 ms 2384 KB Output is correct
90 Correct 17 ms 2128 KB Output is correct
91 Correct 12 ms 1712 KB Output is correct
92 Correct 10 ms 1492 KB Output is correct
93 Correct 17 ms 2480 KB Output is correct
94 Correct 13 ms 1896 KB Output is correct
95 Correct 9 ms 1448 KB Output is correct
96 Correct 34 ms 4388 KB Output is correct
97 Correct 32 ms 4144 KB Output is correct
98 Correct 24 ms 3408 KB Output is correct
99 Correct 19 ms 2768 KB Output is correct
100 Correct 17 ms 2496 KB Output is correct
101 Correct 1 ms 340 KB Output is correct
102 Correct 1 ms 392 KB Output is correct
103 Correct 32 ms 4292 KB Output is correct
104 Correct 1 ms 340 KB Output is correct
105 Correct 4 ms 724 KB Output is correct
106 Correct 6 ms 1108 KB Output is correct
107 Correct 3 ms 712 KB Output is correct
108 Correct 2 ms 724 KB Output is correct
109 Correct 17 ms 2368 KB Output is correct
110 Correct 17 ms 2428 KB Output is correct
111 Correct 32 ms 4332 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 4032 KB Output is correct
115 Correct 2 ms 468 KB Output is correct
116 Correct 2 ms 712 KB Output is correct
117 Correct 10 ms 1492 KB Output is correct
118 Correct 17 ms 2364 KB Output is correct
119 Correct 24 ms 3344 KB Output is correct
120 Correct 27 ms 3420 KB Output is correct
121 Correct 24 ms 3416 KB Output is correct
122 Correct 25 ms 3420 KB Output is correct
123 Correct 33 ms 4288 KB Output is correct
124 Correct 31 ms 4040 KB Output is correct
125 Correct 24 ms 3488 KB Output is correct
126 Correct 26 ms 3496 KB Output is correct
127 Correct 21 ms 2796 KB Output is correct
128 Correct 17 ms 2524 KB Output is correct