Submission #309819

# Submission time Handle Problem Language Result Execution time Memory
309819 2020-10-04T15:18:26 Z AngelKnows Vision Program (IOI19_vision) C++14
100 / 100
38 ms 5624 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i=1;i<=n;i++)
#define REP(i,a,b) for (int i=a;i<=b;i++)
 
#define pb push_back
#define fi first
#define se second
#define pi pair<int,int>
#define mp make_pair
 
typedef long long ll;

const int inf=0x3f3f3f3f;
const ll linf=1e18;
const int N=40000+10;
const double eps=1e-5;
const int mo=1e9+7;

vector<int> a,b,v,p,pos;
int pos_a,pos_b,pos_l_a,pos_r_a,pos_l_b,pos_r_b;
int c=-1,d=-1;
int pos_r_k,pos_c_k,pos_dig=-1,pos_dig2=-1;
vector<int> dig[N],dig2[N];
int l,r;
void construct_network(int h, int w, int k) {

	for (int i=0;i<h;i++) {
		v.clear();
		for (int j=0;j<w;j++) v.pb(i*w+j);
		a.pb(add_or(v));
	}
	for (int j=0;j<w;j++) {
		v.clear();
		for (int i=0;i<h;i++) v.pb(i*w+j);
		b.pb(add_or(v));
	}
	pos_a=add_xor(a);
	pos_b=add_xor(b);
	v.clear();
	for (int j=0;j<w;j++) {
		if (j+k>=w) break;
		v.pb(add_and(vector<int>{b[j],b[j+k]}));
	}
	if (!v.empty()) {
		c=add_or(v);
		pos.pb(add_and(vector<int>{c,pos_a}));
	}
	v.clear();
	for (int i=0;i<h;i++) {
		if (i+k>=h) break;
		v.pb(add_and(vector<int>{a[i],a[i+k]}));
	}
	if (!v.empty()) {
		d=add_or(v);
		pos.pb(add_and(vector<int>{d,pos_b}));
	}
	
	p.clear();
	for (int i=0;i<h;i++) {
		v.clear();
		for (int i2=i;i2<=min(h-1,i+k);i2++) v.pb(a[i2]);
		p.pb(add_and(vector<int>{add_or(v),add_not(add_xor(v))}));
	}
	pos_r_k=add_or(p);
	
	p.clear();
	for (int j=0;j<w;j++) {
		v.clear();
		for (int j2=j;j2<=min(w-1,j+k);j2++) v.pb(b[j2]);
		p.pb(add_and(vector<int>{add_or(v),add_not(add_xor(v))}));
	}
	pos_c_k=add_or(p);
	
	for (int s=0;s<=h+w-2;s++) {
		//printf("%d\n",s);
		for (int i=0;i<h;i++) {
			int j=s-i;
			if (j<0||j>=w) continue;
			dig[s].pb(i*w+j);
			//printf("%d %d\n",i,j);
		}		
	}
	
	v.clear();
	for (int s=0;s<=h+w-2-k;s++) {
		v.pb(add_and(vector<int>{add_or(dig[s]),add_or(dig[s+k])}));
	}
	if (!v.empty()) pos_dig=add_or(v);
	
	for (int s=0;s<=h+w-2;s++) {
		//printf("%d\n",s);
		for (int i=0;i<h;i++) {
			int j=s-(h-1-i);
			if (j<0||j>=w) continue;
			dig2[s].pb(i*w+j);
			//printf("%d %d\n",i,j);
		}
	}
	v.clear();
	for (int s=0;s<=h+w-2-k;s++) {
		v.pb(add_and(vector<int>{add_or(dig2[s]),add_or(dig2[s+k])}));
	}
	if (!v.empty()) pos_dig2=add_or(v);
	
	int t,t2=-1;
	if (pos_dig&&pos_dig2) t2=add_or(vector<int>{pos_dig,pos_dig2});
	else if (pos_dig) t2=pos_dig;
	else if (pos_dig2) t2=pos_dig2;

    if (t2!=-1) t=add_and(vector<int>{add_not(pos_a),add_not(pos_b),t2,pos_c_k,pos_r_k});
    else t=add_xor(vector<int>{0,0}); // 注定得到0 
	pos.pb(t);
	add_or(pos);
	return;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 2 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 2 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 2 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 2 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 2 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 2 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 2 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 2 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 2 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 3 ms 2176 KB Output is correct
25 Correct 2 ms 2176 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 2 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 2 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 2 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 2 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 2 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 3 ms 2176 KB Output is correct
25 Correct 2 ms 2176 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
28 Correct 3 ms 2304 KB Output is correct
29 Correct 2 ms 2176 KB Output is correct
30 Correct 2 ms 2176 KB Output is correct
31 Correct 2 ms 2176 KB Output is correct
32 Correct 3 ms 2432 KB Output is correct
33 Correct 3 ms 2304 KB Output is correct
34 Correct 3 ms 2304 KB Output is correct
35 Correct 3 ms 2304 KB Output is correct
36 Correct 2 ms 2304 KB Output is correct
37 Correct 2 ms 2304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 2 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 2 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 2 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 2 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 2 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 3 ms 2176 KB Output is correct
25 Correct 2 ms 2176 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
28 Correct 3 ms 2304 KB Output is correct
29 Correct 2 ms 2176 KB Output is correct
30 Correct 2 ms 2176 KB Output is correct
31 Correct 2 ms 2176 KB Output is correct
32 Correct 3 ms 2432 KB Output is correct
33 Correct 3 ms 2304 KB Output is correct
34 Correct 3 ms 2304 KB Output is correct
35 Correct 3 ms 2304 KB Output is correct
36 Correct 2 ms 2304 KB Output is correct
37 Correct 2 ms 2304 KB Output is correct
38 Correct 11 ms 3072 KB Output is correct
39 Correct 3 ms 2304 KB Output is correct
40 Correct 3 ms 2304 KB Output is correct
41 Correct 6 ms 2688 KB Output is correct
42 Correct 5 ms 2432 KB Output is correct
43 Correct 10 ms 3072 KB Output is correct
44 Correct 11 ms 3072 KB Output is correct
45 Correct 10 ms 3072 KB Output is correct
46 Correct 8 ms 2816 KB Output is correct
47 Correct 7 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2432 KB Output is correct
2 Correct 6 ms 2560 KB Output is correct
3 Correct 6 ms 2620 KB Output is correct
4 Correct 8 ms 2688 KB Output is correct
5 Correct 3 ms 2432 KB Output is correct
6 Correct 5 ms 2560 KB Output is correct
7 Correct 7 ms 2560 KB Output is correct
8 Correct 7 ms 2688 KB Output is correct
9 Correct 3 ms 2432 KB Output is correct
10 Correct 5 ms 2560 KB Output is correct
11 Correct 6 ms 2560 KB Output is correct
12 Correct 6 ms 2688 KB Output is correct
13 Correct 7 ms 2560 KB Output is correct
14 Correct 7 ms 2688 KB Output is correct
15 Correct 4 ms 2432 KB Output is correct
16 Correct 5 ms 2560 KB Output is correct
17 Correct 6 ms 2560 KB Output is correct
18 Correct 6 ms 2560 KB Output is correct
19 Correct 7 ms 2560 KB Output is correct
20 Correct 7 ms 2688 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 2 ms 2208 KB Output is correct
3 Correct 5 ms 2432 KB Output is correct
4 Correct 6 ms 2432 KB Output is correct
5 Correct 6 ms 2560 KB Output is correct
6 Correct 4 ms 2432 KB Output is correct
7 Correct 4 ms 2432 KB Output is correct
8 Correct 7 ms 2816 KB Output is correct
9 Correct 8 ms 2816 KB Output is correct
10 Correct 7 ms 2688 KB Output is correct
11 Correct 8 ms 2688 KB Output is correct
12 Correct 6 ms 2560 KB Output is correct
13 Correct 4 ms 2432 KB Output is correct
14 Correct 5 ms 2560 KB Output is correct
15 Correct 6 ms 2560 KB Output is correct
16 Correct 7 ms 2560 KB Output is correct
17 Correct 3 ms 2432 KB Output is correct
18 Correct 6 ms 2560 KB Output is correct
19 Correct 7 ms 2560 KB Output is correct
20 Correct 19 ms 3968 KB Output is correct
21 Correct 20 ms 3968 KB Output is correct
22 Correct 16 ms 3712 KB Output is correct
23 Correct 13 ms 3456 KB Output is correct
24 Correct 18 ms 3840 KB Output is correct
25 Correct 19 ms 3840 KB Output is correct
26 Correct 13 ms 3456 KB Output is correct
27 Correct 33 ms 5396 KB Output is correct
28 Correct 37 ms 5624 KB Output is correct
29 Correct 32 ms 5248 KB Output is correct
30 Correct 25 ms 4608 KB Output is correct
31 Correct 22 ms 4344 KB Output is correct
32 Correct 2 ms 2176 KB Output is correct
33 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 5372 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 5 ms 2432 KB Output is correct
4 Correct 7 ms 2816 KB Output is correct
5 Correct 4 ms 2432 KB Output is correct
6 Correct 3 ms 2432 KB Output is correct
7 Correct 18 ms 3840 KB Output is correct
8 Correct 18 ms 3840 KB Output is correct
9 Correct 32 ms 5364 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 2 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 2 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 2 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 2 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 2 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 3 ms 2176 KB Output is correct
25 Correct 2 ms 2176 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
28 Correct 3 ms 2304 KB Output is correct
29 Correct 2 ms 2176 KB Output is correct
30 Correct 2 ms 2176 KB Output is correct
31 Correct 2 ms 2176 KB Output is correct
32 Correct 3 ms 2432 KB Output is correct
33 Correct 3 ms 2304 KB Output is correct
34 Correct 3 ms 2304 KB Output is correct
35 Correct 3 ms 2304 KB Output is correct
36 Correct 2 ms 2304 KB Output is correct
37 Correct 2 ms 2304 KB Output is correct
38 Correct 11 ms 3072 KB Output is correct
39 Correct 3 ms 2304 KB Output is correct
40 Correct 3 ms 2304 KB Output is correct
41 Correct 6 ms 2688 KB Output is correct
42 Correct 5 ms 2432 KB Output is correct
43 Correct 10 ms 3072 KB Output is correct
44 Correct 11 ms 3072 KB Output is correct
45 Correct 10 ms 3072 KB Output is correct
46 Correct 8 ms 2816 KB Output is correct
47 Correct 7 ms 2816 KB Output is correct
48 Correct 4 ms 2432 KB Output is correct
49 Correct 6 ms 2560 KB Output is correct
50 Correct 6 ms 2620 KB Output is correct
51 Correct 8 ms 2688 KB Output is correct
52 Correct 3 ms 2432 KB Output is correct
53 Correct 5 ms 2560 KB Output is correct
54 Correct 7 ms 2560 KB Output is correct
55 Correct 7 ms 2688 KB Output is correct
56 Correct 3 ms 2432 KB Output is correct
57 Correct 5 ms 2560 KB Output is correct
58 Correct 6 ms 2560 KB Output is correct
59 Correct 6 ms 2688 KB Output is correct
60 Correct 7 ms 2560 KB Output is correct
61 Correct 7 ms 2688 KB Output is correct
62 Correct 4 ms 2432 KB Output is correct
63 Correct 5 ms 2560 KB Output is correct
64 Correct 6 ms 2560 KB Output is correct
65 Correct 6 ms 2560 KB Output is correct
66 Correct 7 ms 2560 KB Output is correct
67 Correct 7 ms 2688 KB Output is correct
68 Correct 2 ms 2176 KB Output is correct
69 Correct 2 ms 2176 KB Output is correct
70 Correct 2 ms 2176 KB Output is correct
71 Correct 2 ms 2208 KB Output is correct
72 Correct 5 ms 2432 KB Output is correct
73 Correct 6 ms 2432 KB Output is correct
74 Correct 6 ms 2560 KB Output is correct
75 Correct 4 ms 2432 KB Output is correct
76 Correct 4 ms 2432 KB Output is correct
77 Correct 7 ms 2816 KB Output is correct
78 Correct 8 ms 2816 KB Output is correct
79 Correct 7 ms 2688 KB Output is correct
80 Correct 8 ms 2688 KB Output is correct
81 Correct 6 ms 2560 KB Output is correct
82 Correct 4 ms 2432 KB Output is correct
83 Correct 5 ms 2560 KB Output is correct
84 Correct 6 ms 2560 KB Output is correct
85 Correct 7 ms 2560 KB Output is correct
86 Correct 3 ms 2432 KB Output is correct
87 Correct 6 ms 2560 KB Output is correct
88 Correct 7 ms 2560 KB Output is correct
89 Correct 19 ms 3968 KB Output is correct
90 Correct 20 ms 3968 KB Output is correct
91 Correct 16 ms 3712 KB Output is correct
92 Correct 13 ms 3456 KB Output is correct
93 Correct 18 ms 3840 KB Output is correct
94 Correct 19 ms 3840 KB Output is correct
95 Correct 13 ms 3456 KB Output is correct
96 Correct 33 ms 5396 KB Output is correct
97 Correct 37 ms 5624 KB Output is correct
98 Correct 32 ms 5248 KB Output is correct
99 Correct 25 ms 4608 KB Output is correct
100 Correct 22 ms 4344 KB Output is correct
101 Correct 2 ms 2176 KB Output is correct
102 Correct 2 ms 2176 KB Output is correct
103 Correct 33 ms 5372 KB Output is correct
104 Correct 2 ms 2176 KB Output is correct
105 Correct 5 ms 2432 KB Output is correct
106 Correct 7 ms 2816 KB Output is correct
107 Correct 4 ms 2432 KB Output is correct
108 Correct 3 ms 2432 KB Output is correct
109 Correct 18 ms 3840 KB Output is correct
110 Correct 18 ms 3840 KB Output is correct
111 Correct 32 ms 5364 KB Output is correct
112 Correct 2 ms 2176 KB Output is correct
113 Correct 2 ms 2176 KB Output is correct
114 Correct 38 ms 5624 KB Output is correct
115 Correct 6 ms 2560 KB Output is correct
116 Correct 3 ms 2432 KB Output is correct
117 Correct 15 ms 3456 KB Output is correct
118 Correct 20 ms 3968 KB Output is correct
119 Correct 31 ms 5240 KB Output is correct
120 Correct 32 ms 5240 KB Output is correct
121 Correct 32 ms 5240 KB Output is correct
122 Correct 32 ms 5236 KB Output is correct
123 Correct 33 ms 5364 KB Output is correct
124 Correct 37 ms 5624 KB Output is correct
125 Correct 32 ms 5240 KB Output is correct
126 Correct 32 ms 5240 KB Output is correct
127 Correct 26 ms 4608 KB Output is correct
128 Correct 23 ms 4352 KB Output is correct