Submission #1195302

#TimeUsernameProblemLanguageResultExecution timeMemory
1195302nikulidVision Program (IOI19_vision)C++20
0 / 100
5 ms1096 KiB
#include "vision.h"
#include <math.h>
#include <vector>

using namespace std;

int dist(int a, int b, int w){
	int ra, ca, rb, cb;
	ra = a%w;
	rb = b%w;
	ca = a/w;
	cb = b/w;
	return abs(ra-rb)+abs(ca-cb);
}

void construct_network(int H, int W, int K) {

	// subtask everything:
	// this is such krazy problem: I like a lot
	// thus I have decided to not attempt q3 and just waste the rest of my time getting what will likely be 0 on q2
	// :sunglasses:


	vector<int> ns, pns;
	vector<int> rows; // indices of XORs of rows
	vector<int> columns; // indices of XORs of columns

	// handle each horizontal row (whatever that means) (I just yap)
	int i_want_a_banana = true;

	for(int y=0; y<H; y++){
		ns.clear();
		for(int x=0; x<W; x++){
			ns.push_back(y*W + x);
		}
		i_want_a_banana = add_xor(ns);
		rows.push_back(i_want_a_banana);
	}

	for(int x=0; x<W; x++){
		ns.clear();
		for(int y=0; y<H; y++){
			ns.push_back(y*W + x);
		}
		i_want_a_banana = add_xor(ns);
		columns.push_back(i_want_a_banana);
	}

	vector<int> all_working_scenarios;
	vector<int> deltas;
	int P1, P2, FP1, FP2;
	if(K==1){
		// let's handle this subtask real quick (subtask 7)
		// I do want 14 marks after all :yum:

		// (a,b) === (row[], column[]) === (y,x)

		// scenario 1: difference of indices are (0+1)
		
		// we need straight 0s in `rows`
		i_want_a_banana = add_or(rows);
		P1 = add_not(i_want_a_banana);
		// <=> we need P1=true

		// and we need one pair of contiguous 1s in `columns`
		// <=> we need there to be a distance of `1` inbetween the 1s in `columns`
		for(int i=1; i<W; i++){
			ns = {columns[i-1], columns[i]};
			i_want_a_banana = add_and(ns);
			pns.push_back(i_want_a_banana);
		}
		if(pns.size()==0){
			ns = {0,0};
			FP2 = add_xor(ns);
		} else{
			P2 = add_or(pns);
			// <=> we need P2=true
			// ;)
			
			ns = {P1, P2};
			FP1 = add_and(ns);
		}

		// scenario 2: difference of indices are (1+0)

		// we need straight 0s in `columns`
		i_want_a_banana = add_or(columns);
		P1 = add_not(i_want_a_banana);
		// <=> we need P1 = true

		// and we need one pair of contiguous 1s in `rows`
		// <=> we need there to be a distance of `1` inbetween the 1s in `columns`
		for(int i=1; i<H; i++){
			ns = {rows[i-1], rows[i]};
			i_want_a_banana = add_and(ns);
			pns.push_back(i_want_a_banana);
		}
		P2 = add_or(pns);
		// <=> we need P2=true

		ns = {P1, P2};
		FP2 = add_and(ns);

		ns = {FP1, FP2};
		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...