# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774843 | khshg | Cave (IOI13_cave) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
void exploreCave(int N) {
vector<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;
vector<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] = tm;
StoD[tm] = i;
cor[tm] = !f;
}
answer(cor, StoD);
}