Submission #1195349

#TimeUsernameProblemLanguageResultExecution timeMemory
1195349clementineVision Program (IOI19_vision)C++20
0 / 100
5 ms1092 KiB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;

int dist(int i, int j, int W, int H)
{
	int xi = i % W;
	int yi = i / W;
	int xj = j % W;
	int yj = j / W;

	return abs(xi - xj) + abs(yi - yj);
}

void construct_network(int H, int W, int K) 
{
	if(H == 1)
	{
		vector<int> Ns(2, -1);
		add_and(Ns);
	}
	if(H == 2)
	{
		vector<int> Ns(2, -1);
		add_and(Ns);
	}
	vector<int> Ns;
	int cur = 0;
	for(int i = 0; i < W; i ++)
	{
		Ns.clear();
		for(int j = 0; j < H; j ++)
		{
			Ns.push_back(j * W + i);
		}
		cur = add_xor(Ns);
	}
	Ns.clear();
	for(int i = H * W; i <= cur; i ++)
	{
		Ns.push_back(i);
	}
	int temp = add_or(Ns);
	int col_xor_res = add_not(temp);

	for(int i = H * W; i < temp - 1; i ++)
	{
		Ns.clear();
		Ns.push_back(i);
		Ns.push_back(i + 1);
		cur = add_and(Ns);
	}
	Ns.clear();
	for(int i = col_xor_res + 1; i <= cur; i ++)
	{
		Ns.push_back(i);
	}
	int col_pair_and_res = add_or(Ns);
	for(int i = 0; i < H; i ++)
	{
		Ns.clear();
		for(int j = 0; j < W; j ++)
		{
			Ns.push_back(i * W + j);
		}
		cur = add_xor(Ns);
	}
	Ns.clear();
	for(int i = col_pair_and_res + 1; i <= cur; i ++)
	{
		Ns.push_back(i);
	}
	int temp3 = add_or(Ns);
	int row_xor_res = add_not(temp3);
	int row_xor_end = cur;
	Ns.clear();
	for(int i = col_pair_and_res + 1; i < row_xor_end; i ++)
	{
		Ns.clear();
		Ns.push_back(i);
		Ns.push_back(i + 1);
		cur = add_and(Ns);
	}
	Ns.clear();
	for(int i = row_xor_res + 1; i <= cur; i ++)
	{
		Ns.push_back(i);
	}
	int row_and_pair_res = add_or(Ns);
	
	Ns.clear();
	Ns.push_back(row_and_pair_res);
	Ns.push_back(col_xor_res);
	int neardone = add_and(Ns);
	Ns.clear();
	Ns.push_back(col_pair_and_res);
	Ns.push_back(row_xor_res);
	int neardone2 = add_and(Ns);
	Ns.clear();
	Ns.push_back(neardone);
	Ns.push_back(neardone2);
	add_or(Ns);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...