Submission #231074

# Submission time Handle Problem Language Result Execution time Memory
231074 2020-05-12T15:07:40 Z tinjyu Vision Program (IOI19_vision) C++14
0 / 100
16 ms 1532 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)
{
	
	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;
	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;
	}
	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 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 640 KB Output is correct
2 Correct 6 ms 544 KB Output is correct
3 Correct 6 ms 640 KB Output is correct
4 Incorrect 5 ms 512 KB WA in grader: Instruction with no inputs
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1532 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 512 KB Output is correct
4 Correct 7 ms 640 KB Output is correct
5 Correct 7 ms 544 KB Output is correct
6 Correct 7 ms 640 KB Output is correct
7 Correct 12 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 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -