Submission #309792

# Submission time Handle Problem Language Result Execution time Memory
309792 2020-10-04T14:25:49 Z AngelKnows Vision Program (IOI19_vision) C++14
0 / 100
3 ms 2560 KB
#include "vision.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
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,d;
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);
	l=r=-1;
	for (int j=0;j<w;j++) {
		if (j+k>=w) break;
		v.clear();
		v.pb(b[j]);
		v.pb(b[j+k]);
		if (j==0) l=add_and(v);
		else if (j==w-1) r=add_and(v);
		else add_and(v);
		
		if (w==1) r=l;
	}
	if (l!=-1) {
		v.clear();
		for (int i=l;i<=r;i++) v.pb(i);
		c=add_or(v);
		pos.pb(add_and(vector<int>{c,pos_a}));
	}
	l=r=-1;
	for (int i=0;i<h;i++) {
		if (i+k>=h) break;
		v.clear();
		v.pb(a[i]);
		v.pb(a[i+k]); 
		if (i==0) l=add_and(v);
		else if (i==h-1) r=add_and(v);
		else add_and(v);
		
		if (h==1) r=l;
	}
	if (l!=-1) {
		v.clear();
		for (int i=l;i<=r;i++) v.pb(i);
		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))}));
	}
	v.clear();
	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))}));
	}
	v.clear();
	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=add_and(vector<int>{add_not(add_and(vector<int>{add_not(d),pos_b})),add_not(add_and(vector<int>{add_not(c),pos_a})),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 Incorrect 2 ms 2176 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2176 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2176 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2176 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2176 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2176 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2560 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2176 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -