제출 #774846

#제출 시각아이디문제언어결과실행 시간메모리
774846khshg동굴 (IOI13_cave)C++14
0 / 100
164 ms448 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
	int cor[N], DtoS[N], StoD[N];
	for(int i = 0; i < N; ++i) {
		bool f = (tryCombination(cor) == i);
		int tl = 0, tr = N - 1;
		while(tl < tr) {
			int tm = (tl + tr) / 2;
			int ask[N];
			for(int j = 0; j <= tm; ++j) {
				ask[j] = 1;
			}
			for(int j = 0; j < i; ++j) ask[DtoS[j]] = cor[DtoS[j]];
			bool F = (tryCombination(ask) == i);
			if(F == f) {
				tl = tm + 1;
			} else tr = tm;
		}
		DtoS[i] = tl;
		StoD[tl] = i;
		cor[tl] = !f;
	}
	answer(cor, StoD);
}
#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...