Submission #231075

# Submission time Handle Problem Language Result Execution time Memory
231075 2020-05-12T15:20:17 Z tinjyu Vision Program (IOI19_vision) C++14
100 / 100
19 ms 1856 KB
#include "vision.h"
#include <iostream>
#include <vector>
using namespace std;
long long int n,m,k,tmp,now,ra[10005],la[10005],rsum[10005][2],lsum[10005][2];
void check(int g)
{
	if(g==n+m-2)
	{
		vector<int> v;
		for(int i=0;i<n*m;i++)v.push_back(i);
		now++;
		add_or(v);
		return ;
	}
	vector<int> v;
	rsum[1][0]=ra[1];
	rsum[ra[0]][1]=ra[ra[0]];
	for(int i=2;i<=ra[0];i++)
	{
		v.clear();
		v.push_back(rsum[i-1][0]);
		v.push_back(ra[i]);
		add_or(v);
		now++;
		rsum[i][0]=now;
	}
	for(int i=ra[0]-1;i>=1;i--)
	{
		v.clear();
		v.push_back(rsum[i+1][1]);
		v.push_back(ra[i]);
		add_or(v);
		now++;
		rsum[i][1]=now;
	}
	for(int i=1;i<=ra[0];i++)
	{
		//cout<<rsum[i][0]<<" "<<rsum[i][1]<<endl; 
	}
	lsum[1][0]=la[1];
	lsum[la[0]][1]=la[la[0]];
	for(int i=2;i<=la[0];i++)
	{
		v.clear();
		v.push_back(lsum[i-1][0]);
		v.push_back(la[i]);
		add_or(v);
		now++;
		lsum[i][0]=now;
	}
	for(int i=la[0]-1;i>=1;i--)
	{
		v.clear();
		v.push_back(lsum[i+1][1]);
		v.push_back(la[i]);
		add_or(v);
		now++;
		lsum[i][1]=now;
	}
	vector<int> v2;
		
	//cout<<g<<endl;
	for(int i=1;i<=ra[0]-g-1;i++)
	{
		v.clear();
		v.push_back(rsum[i][0]);
		v.push_back(rsum[i+g+1][1]);
		add_and(v);
		now++;
		v2.push_back(now);
		//cout<<i<<" "<<now<<endl;
	}
	//cout<<endl;
	add_or(v2);
	now++;
	long long int x=now;
	v2.clear();	

	for(int i=1;i<=la[0]-g-1;i++)
	{
		v.clear();
		v.push_back(lsum[i][0]);
		v.push_back(lsum[i+g+1][1]);
		add_and(v);
		now++;
		v2.push_back(now);
	}
	add_or(v2);
	now++;
	long long int y=now;
	v2.clear();
	v2.push_back(x);
	v2.push_back(y);
	add_or(v2);
	now++;
	add_not(now);
	now++;
}
void construct_network(int H, int W, int K) {
	vector<int> v;
	n=H;
	m=W;
	k=K;
	now=n*m-1;
	for(int i=m;i>=1;i--)
	{
		v.clear();
		long long int x=1,y=i,p=0;
		while(x<=n && y<=m)
		{
			v.push_back((x-1)*m+y-1);
			p++;
			x++;
			y++;
		}
		//for(int i=0;i<p;i++)cout<<v[i]<<" ";
		//cout<<endl;
		tmp=add_or(v);
		now++;
		ra[0]++;
		ra[ra[0]]=now;
	}
	for(int i=2;i<=n;i++)
	{
		v.clear();
		long long int x=i,y=1,p=0;
		while(x<=n && y<=m)
		{
			v.push_back((x-1)*m+y-1);
			p++;
			x++;
			y++;
		}
		//for(int i=0;i<p;i++)cout<<v[i]<<" ";
		//cout<<endl;
		tmp=add_or(v);
		now++;
		ra[0]++;
		ra[ra[0]]=now;
	}
	for(int i=1;i<=m;i++)
	{
		v.clear();
		long long int x=1,y=i,p=0;
		while(x<=n && y>=1)
		{
			v.push_back((x-1)*m+y-1);
			x++;
			y--;
			p++; 
		}
		tmp=add_or(v);
		now++;
		la[0]++;
		la[la[0]]=now;
	}
	for(int i=2;i<=n;i++)
	{
		v.clear();
		long long int x=i,y=m,p=0;
		while(x<=n && y>=1)
		{
			v.push_back((x-1)*m+y-1);
			x++;
			y--;
			p++; 
		}
		tmp=add_or(v);
		now++;
		la[0]++;
		la[la[0]]=now;
	}
	check(k-1);
	long long int x=now;
	check(k);
	long long int y=now;
	//cout<<x<<" "<<y<<endl;
	vector<int>v2;
	v2.push_back(x);
	v2.push_back(y);
	add_xor(v2);
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 6 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 6 ms 512 KB Output is correct
37 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 6 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 6 ms 512 KB Output is correct
37 Correct 6 ms 384 KB Output is correct
38 Correct 8 ms 768 KB Output is correct
39 Correct 5 ms 512 KB Output is correct
40 Correct 5 ms 512 KB Output is correct
41 Correct 9 ms 640 KB Output is correct
42 Correct 6 ms 512 KB Output is correct
43 Correct 8 ms 768 KB Output is correct
44 Correct 8 ms 768 KB Output is correct
45 Correct 8 ms 768 KB Output is correct
46 Correct 8 ms 768 KB Output is correct
47 Correct 8 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 640 KB Output is correct
2 Correct 6 ms 640 KB Output is correct
3 Correct 6 ms 640 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 6 ms 640 KB Output is correct
6 Correct 6 ms 640 KB Output is correct
7 Correct 6 ms 512 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
9 Correct 6 ms 640 KB Output is correct
10 Correct 6 ms 640 KB Output is correct
11 Correct 6 ms 640 KB Output is correct
12 Correct 6 ms 640 KB Output is correct
13 Correct 6 ms 512 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 6 ms 640 KB Output is correct
16 Correct 6 ms 640 KB Output is correct
17 Correct 6 ms 640 KB Output is correct
18 Correct 6 ms 640 KB Output is correct
19 Correct 6 ms 640 KB Output is correct
20 Correct 5 ms 512 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 6 ms 512 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 512 KB Output is correct
7 Correct 6 ms 512 KB Output is correct
8 Correct 7 ms 640 KB Output is correct
9 Correct 7 ms 640 KB Output is correct
10 Correct 7 ms 768 KB Output is correct
11 Correct 7 ms 640 KB Output is correct
12 Correct 7 ms 640 KB Output is correct
13 Correct 6 ms 640 KB Output is correct
14 Correct 6 ms 640 KB Output is correct
15 Correct 6 ms 512 KB Output is correct
16 Correct 5 ms 512 KB Output is correct
17 Correct 6 ms 640 KB Output is correct
18 Correct 6 ms 640 KB Output is correct
19 Correct 5 ms 512 KB Output is correct
20 Correct 11 ms 1020 KB Output is correct
21 Correct 11 ms 1024 KB Output is correct
22 Correct 11 ms 1024 KB Output is correct
23 Correct 12 ms 1280 KB Output is correct
24 Correct 11 ms 1020 KB Output is correct
25 Correct 11 ms 1024 KB Output is correct
26 Correct 12 ms 1280 KB Output is correct
27 Correct 16 ms 1660 KB Output is correct
28 Correct 16 ms 1532 KB Output is correct
29 Correct 15 ms 1532 KB Output is correct
30 Correct 16 ms 1532 KB Output is correct
31 Correct 19 ms 1856 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1532 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 7 ms 512 KB Output is correct
4 Correct 7 ms 640 KB Output is correct
5 Correct 6 ms 640 KB Output is correct
6 Correct 6 ms 640 KB Output is correct
7 Correct 11 ms 1020 KB Output is correct
8 Correct 11 ms 1020 KB Output is correct
9 Correct 16 ms 1532 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 6 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 6 ms 512 KB Output is correct
37 Correct 6 ms 384 KB Output is correct
38 Correct 8 ms 768 KB Output is correct
39 Correct 5 ms 512 KB Output is correct
40 Correct 5 ms 512 KB Output is correct
41 Correct 9 ms 640 KB Output is correct
42 Correct 6 ms 512 KB Output is correct
43 Correct 8 ms 768 KB Output is correct
44 Correct 8 ms 768 KB Output is correct
45 Correct 8 ms 768 KB Output is correct
46 Correct 8 ms 768 KB Output is correct
47 Correct 8 ms 768 KB Output is correct
48 Correct 6 ms 640 KB Output is correct
49 Correct 6 ms 640 KB Output is correct
50 Correct 6 ms 640 KB Output is correct
51 Correct 5 ms 512 KB Output is correct
52 Correct 6 ms 640 KB Output is correct
53 Correct 6 ms 640 KB Output is correct
54 Correct 6 ms 512 KB Output is correct
55 Correct 6 ms 512 KB Output is correct
56 Correct 6 ms 640 KB Output is correct
57 Correct 6 ms 640 KB Output is correct
58 Correct 6 ms 640 KB Output is correct
59 Correct 6 ms 640 KB Output is correct
60 Correct 6 ms 512 KB Output is correct
61 Correct 5 ms 512 KB Output is correct
62 Correct 6 ms 640 KB Output is correct
63 Correct 6 ms 640 KB Output is correct
64 Correct 6 ms 640 KB Output is correct
65 Correct 6 ms 640 KB Output is correct
66 Correct 6 ms 640 KB Output is correct
67 Correct 5 ms 512 KB Output is correct
68 Correct 4 ms 384 KB Output is correct
69 Correct 4 ms 384 KB Output is correct
70 Correct 5 ms 384 KB Output is correct
71 Correct 4 ms 384 KB Output is correct
72 Correct 6 ms 512 KB Output is correct
73 Correct 6 ms 504 KB Output is correct
74 Correct 6 ms 512 KB Output is correct
75 Correct 6 ms 512 KB Output is correct
76 Correct 6 ms 512 KB Output is correct
77 Correct 7 ms 640 KB Output is correct
78 Correct 7 ms 640 KB Output is correct
79 Correct 7 ms 768 KB Output is correct
80 Correct 7 ms 640 KB Output is correct
81 Correct 7 ms 640 KB Output is correct
82 Correct 6 ms 640 KB Output is correct
83 Correct 6 ms 640 KB Output is correct
84 Correct 6 ms 512 KB Output is correct
85 Correct 5 ms 512 KB Output is correct
86 Correct 6 ms 640 KB Output is correct
87 Correct 6 ms 640 KB Output is correct
88 Correct 5 ms 512 KB Output is correct
89 Correct 11 ms 1020 KB Output is correct
90 Correct 11 ms 1024 KB Output is correct
91 Correct 11 ms 1024 KB Output is correct
92 Correct 12 ms 1280 KB Output is correct
93 Correct 11 ms 1020 KB Output is correct
94 Correct 11 ms 1024 KB Output is correct
95 Correct 12 ms 1280 KB Output is correct
96 Correct 16 ms 1660 KB Output is correct
97 Correct 16 ms 1532 KB Output is correct
98 Correct 15 ms 1532 KB Output is correct
99 Correct 16 ms 1532 KB Output is correct
100 Correct 19 ms 1856 KB Output is correct
101 Correct 4 ms 384 KB Output is correct
102 Correct 5 ms 384 KB Output is correct
103 Correct 16 ms 1532 KB Output is correct
104 Correct 4 ms 384 KB Output is correct
105 Correct 7 ms 512 KB Output is correct
106 Correct 7 ms 640 KB Output is correct
107 Correct 6 ms 640 KB Output is correct
108 Correct 6 ms 640 KB Output is correct
109 Correct 11 ms 1020 KB Output is correct
110 Correct 11 ms 1020 KB Output is correct
111 Correct 16 ms 1532 KB Output is correct
112 Correct 4 ms 256 KB Output is correct
113 Correct 4 ms 384 KB Output is correct
114 Correct 16 ms 1532 KB Output is correct
115 Correct 6 ms 512 KB Output is correct
116 Correct 6 ms 640 KB Output is correct
117 Correct 11 ms 1024 KB Output is correct
118 Correct 11 ms 1024 KB Output is correct
119 Correct 16 ms 1532 KB Output is correct
120 Correct 15 ms 1532 KB Output is correct
121 Correct 15 ms 1532 KB Output is correct
122 Correct 15 ms 1532 KB Output is correct
123 Correct 16 ms 1660 KB Output is correct
124 Correct 17 ms 1532 KB Output is correct
125 Correct 16 ms 1532 KB Output is correct
126 Correct 16 ms 1532 KB Output is correct
127 Correct 15 ms 1532 KB Output is correct
128 Correct 18 ms 1856 KB Output is correct