답안 #432724

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
432724 2021-06-18T12:52:54 Z mosiashvililuka Vision Program (IOI19_vision) C++14
0 / 100
5 ms 2760 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
const int N=200;
int a,b,c,d,e,i,j,ii,jj,zx,xc,k,K,COUNTI,MASIVI[1000009],nuli,XOR[1009],OR[1009];
vector <pair <int, int> > X[1009],Y[1009];
vector <int> vv,v,va,vz,vx;
//
/*int add_xor(vector <int> q){
	if(q.size()==0){
		cout<<"ADDXOR";
		exit(0);
	}
	int qw=0;
	for(int qq=0; qq<q.size(); qq++){
		qw^=MASIVI[q[qq]];
	}
	COUNTI++;MASIVI[COUNTI]=qw;
	return COUNTI;
}
int add_or(vector <int> q){
	if(q.size()==0){
		cout<<"ADDOR";
		exit(0);
	}
	int qw=0;
	for(int qq=0; qq<q.size(); qq++){
		qw|=MASIVI[q[qq]];
	}
	COUNTI++;MASIVI[COUNTI]=qw;
	return COUNTI;
}
int add_and(vector <int> q){
	if(q.size()==0){
		cout<<"ADDAND";
		exit(0);
	}
	int qw=1;
	for(int qq=0; qq<q.size(); qq++){
		qw&=MASIVI[q[qq]];
	}
	COUNTI++;MASIVI[COUNTI]=qw;
	return COUNTI;
}
int add_not(int q){
	int qq=0;
	if(MASIVI[q]==0) qq=1; else qq=0;
	COUNTI++;MASIVI[COUNTI]=qq;
	return COUNTI;
}*/
//
int TWONUMBER(vector <int> q){
	int qw=0,we=0;
	vector <int> QW,WE;
	//QW.push_back(q);QW.push_back(w);
	qw=add_or(q);we=add_xor(q);
	WE.push_back(qw);WE.push_back(we);
	return add_xor(WE);
}
int F(int q, int w){
	return q*b+w;
}
int solve(int KK){
	K=KK;
	int QW=0,WE=0;
	va.clear();
	for(i=0; i<420; i++){
		vv.clear();
		for(vector <pair <int, int> >::iterator it=X[i].begin(); it!=X[i].end(); it++){
			vv.push_back(F((*it).first,(*it).second));
		}
		int ee=0;
		if(i==0) ee=nuli; else ee=XOR[i-1];
		if(vv.size()!=0) XOR[i]=add_xor(vv); else XOR[i]=nuli;
		vx.clear();vx.push_back(XOR[i]);vx.push_back(ee);
		XOR[i]=add_xor(vx);
		if(i==0) ee=nuli; else ee=OR[i-1];
		if(vv.size()!=0) OR[i]=add_or(vv); else OR[i]=nuli;
		vx.clear();vx.push_back(OR[i]);vx.push_back(ee);
		OR[i]=add_or(vx);
		if(i==K-1){
			//if(vv.size()!=0) va.push_back(TWONUMBER(vv)); else va.push_back(nuli);
			vx.clear();vx.push_back(XOR[i]);vx.push_back(OR[i]);
			va.push_back(add_xor(vx));
			continue;
		}
		if(i>K-1){
			v.clear();
			vx.clear();
			vx.push_back(XOR[i]);vx.push_back(XOR[i-K]);
			//v.push_back(add_xor(vx));
			v.push_back(add_not(add_xor(vx)));
			vx.clear();
			vx.push_back(OR[i]);vx.push_back(OR[i-K]);
			v.push_back(add_xor(vx));
			va.push_back(add_and(v));
			//va.push_back(add_xor(v));
			continue;
		}
	}
	//cout<<MASIVI[va[0]]<<endl;
	QW=add_or(va);
	
	
	//
	
	
	
	va.clear();
	for(i=0; i<420; i++){
		vv.clear();
		for(vector <pair <int, int> >::iterator it=Y[i].begin(); it!=Y[i].end(); it++){
			vv.push_back(F((*it).first,(*it).second));
		}
		int ee=0;
		if(i==0) ee=nuli; else ee=XOR[i-1];
		if(vv.size()!=0) XOR[i]=add_xor(vv); else XOR[i]=nuli;
		vx.clear();vx.push_back(XOR[i]);vx.push_back(ee);
		XOR[i]=add_xor(vx);
		if(i==0) ee=nuli; else ee=OR[i-1];
		if(vv.size()!=0) OR[i]=add_or(vv); else OR[i]=nuli;
		vx.clear();vx.push_back(OR[i]);vx.push_back(ee);
		OR[i]=add_or(vx);
		if(i==K-1){
			//if(vv.size()!=0) va.push_back(TWONUMBER(vv)); else va.push_back(nuli);
			vx.clear();vx.push_back(XOR[i]);vx.push_back(OR[i]);
			va.push_back(add_xor(vx));
			continue;
		}
		if(i>K-1){
			v.clear();
			vx.clear();
			vx.push_back(XOR[i]);vx.push_back(XOR[i-K]);
			//v.push_back(add_xor(vx));
			v.push_back(add_not(add_xor(vx)));
			vx.clear();
			vx.push_back(OR[i]);vx.push_back(OR[i-K]);
			v.push_back(add_xor(vx));
			va.push_back(add_and(v));
			//va.push_back(add_xor(v));
			continue;
		}
	}
	//cout<<MASIVI[va[0]]<<endl;
	WE=add_or(va);
	
	vv.clear();vv.push_back(QW);vv.push_back(WE);
	//cout<<MASIVI[QW]<<" "<<MASIVI[WE]<<"    "<<K<<endl;
	return add_and(vv);
}
void construct_network(int H, int W, int KK) {
	if(H*W==2){
		vv.clear();vv.push_back(0);vv.push_back(1);
		nuli=add_xor(vv);
	}else{
		vv.clear();vv.push_back(0);vv.push_back(1);vv.push_back(2);
		nuli=add_and(vv);
	}
	a=H;b=W;k=KK;
	for(i=0; i<H; i++){
		for(j=0; j<W; j++){
			X[i+j].push_back(make_pair(i,j));
			Y[i-j+N].push_back(make_pair(i,j));
		}
	}
	int AX=solve(k);
	int AZ=solve(k+1);
	vv.clear();vv.push_back(AZ);vv.push_back(AX);
	add_xor(vv);
}
 
 
 
 
 
 
/*int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b>>k;
	cin>>c>>d>>zx>>xc;
	MASIVI[F(c,d)]=1;
	MASIVI[F(zx,xc)]=1;
	COUNTI=F(a-1,b-1);
	c=0;d=0;zx=0;xc=0;
	construct_network(a,b,k);
	cout<<MASIVI[COUNTI];
	return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1096 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1096 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1096 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1096 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1096 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1096 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 2760 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1096 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -