Submission #482026

#TimeUsernameProblemLanguageResultExecution timeMemory
482026glomeCave (IOI13_cave)C++17
0 / 100
467 ms388 KiB
#include "cave.h"
#include<bits/stdc++.h>

using namespace std;
void exploreCave(int N) {
	int what[N];
	int where[N];
	bool ok[N];
	for (int i = 0; i<N; i++) {	
		int k = tryCombination(what);
		int now = 0;
		if(k == -1 || k == i) {
			now = 1;
		}
		int l = 0, r = N - 1;
		int pos;
		while(l < r) {	
			int temp[N];
			int l1 = 0, r1 = (l + r + 1) / 2;
			int l2 = (l + r + 1) / 2 + 1, r2 = r;
			for (int j = 0; j<N; j++) {
				if(ok[j]) {
					temp[j] = what[j];
					continue;
				}
				if(j >= l2 && j <= r2) {
					temp[j] = now;
				}	
				else {
					temp[j] = now ^ 1;
				}
			}
			int lx = tryCombination(temp);
			if(lx == -1 || lx == i) {
				l = l1, r = r1;
			}
			else {
				l = l2, r = r2;
			}
		}
		pos = l;
		what[pos] = now;
		where[i] = pos;
		ok[pos] = 1;
	}
	answer(what, where);
}
#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...