# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103618 | turbat | 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 <bits/stdc++.h>
#include "cave.h"
void exploreCave(int N) {
int a[N], s[N], d[N], found[N],l, r, t;
memset(s, 0, sizeof s);
d = s;
for (int i = 0;i < N;i++)
for (int i = 0;i < N;i++){
a = s;
if (tryCombination(a) > i) t = 0;
else t = 1;
l = 0, r = n - 1;
while (l != r){
a = s;
int mid = 0;
for (int i = l;i <= mid;i++)
if (!found[i])
a[i] = t;
if (tryCombination(a) > i) r = mid;
else l = mid + 1;
}
d[l] = i;
found[l] = 1;
s[l] = t;
}
answer(s, d);
}