Submission #309794

# Submission time Handle Problem Language Result Execution time Memory
309794 2020-10-04T14:36:55 Z AngelKnows Vision Program (IOI19_vision) C++14
26 / 100
33 ms 5420 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,pos_dig2;
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-3;s++) {
		v.pb(add_and(vector<int>{add_or(dig[s]),add_or(dig[s+1])}));
	}
	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-3;s++) {
		v.pb(add_and(vector<int>{add_or(dig2[s]),add_or(dig2[s+1])}));
	}
	pos_dig2=add_or(v);
	
	int t,t2=-1;
	if (c!=-1&&d!=-1) t2=add_and(vector<int>{add_not(add_and(vector<int>{add_not(c),pos_a})),add_not(add_and(vector<int>{add_not(d),pos_b}))});
	else if (c!=-1) t2=add_not(add_and(vector<int>{add_not(c),pos_a}));
	else if (d!=-1) t2=add_not(add_and(vector<int>{add_not(d),pos_b}));
	if (t2!=-1) t=add_and(vector<int>{t2,add_or(vector<int>{pos_dig,pos_dig2}),pos_c_k,pos_r_k});
    else t=add_and(vector<int>{add_or(vector<int>{pos_dig,pos_dig2}),pos_c_k,pos_r_k});
	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 Incorrect 2 ms 2176 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 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 Incorrect 2 ms 2176 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 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 Incorrect 2 ms 2176 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 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 Incorrect 2 ms 2176 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2432 KB Output is correct
2 Correct 6 ms 2688 KB Output is correct
3 Correct 6 ms 2688 KB Output is correct
4 Correct 7 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 2688 KB Output is correct
8 Correct 8 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 2688 KB Output is correct
12 Correct 7 ms 2688 KB Output is correct
13 Correct 7 ms 2688 KB Output is correct
14 Correct 7 ms 2688 KB Output is correct
15 Correct 3 ms 2432 KB Output is correct
16 Correct 6 ms 2560 KB Output is correct
17 Correct 7 ms 2688 KB Output is correct
18 Correct 7 ms 2688 KB Output is correct
19 Correct 7 ms 2688 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 Incorrect 2 ms 2176 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 5420 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 3 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 33 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 Incorrect 2 ms 2176 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -