Submission #157282

#TimeUsernameProblemLanguageResultExecution timeMemory
157282ZikXewenCave (IOI13_cave)C++11
0 / 100
264 ms512 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;

void exploreCave(int N){
	int st[N], nw[N], co[N];
	vector<int> lf(N);
	iota(lf.begin(), lf.end(), 0);
	for(int te = tryCombination(st); te != -1; te = tryCombination(st)) st[te] = 1; 
	for(int i = 0; i < N; i++) {
		int l = 0, r = lf.size() - 1;
		while(l < r) {
			int m = (l + r) >> 1;
			copy(st, st + N, nw);
			for(int j = l; j <= m; j++) nw[j] = !st[lf[j]];
			if(tryCombination(nw) == i) r = m;
			else l = m + 1;
		}
		co[lf[l]] = i;
		lf.erase(lf.begin() + l);
	}
	answer(st, co);
}
#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...