Submission #252385

#TimeUsernameProblemLanguageResultExecution timeMemory
252385yuma220284Cave (IOI13_cave)C++14
100 / 100
192 ms964 KiB
#include "cave.h"
#include <iostream>
using namespace std;

void exploreCave(int N) {
	static int ANS1[5000] = {}, ANS2[5000] = {}; //ANS1:Switch ANS2:Door
	static int Q[14][5000] = {};
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 14; j++) {
			Q[j][i] = (i >> j) & 1;
		}
	}
	for (int i = 0; i < N; i++) {
		/*for (int j = 0; j < 14; j++) {
			for (int k = 0; k < N; k++) cout << Q[j][k] << ' ';
			cout << endl;
		}
		cout << endl;*/
		int X = tryCombination(Q[13]);
		int Y = 0;
		for (int j = 0; j < 13; j++) {
			int Z = tryCombination(Q[j]);
			if (Z > i || Z == -1) Y += 1 << j;
		}
		int A, B;
		//cout << X << ' ' << Y << ' ';
		if (X == i) A = 1, B = Y;
		else A = 0, B = 8191 - Y;
		//cout << A << ' ' << B << endl << endl;
		ANS1[B] = A, ANS2[B] = i;
		for (int j = 0; j < 14; j++) {
			Q[j][B] = A;
		}
	}
	answer(ANS1, ANS2);
}
#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...