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);
memset(found, 0, sizeof found);
for (int i = 0;i < N;i++){
for (int i = 0;i < N;i++)
a[i] = s[i];
int tmp = tryCombination(a);
if (tmp > i || tmp == -1) t = 0;
else t = 1;
l = 0, r = N - 1;
while (l != r){
for (int i = 0;i < N;i++)
a[i] = s[i];
int mid = (l + r) / 2;
for (int i = l;i <= mid;i++)
if (!found[i])
a[i] = t;
tmp = tryCombination(a);
if (tmp > i || tmp == -1) r = mid;
else l = mid + 1;
}
d[l] = i;
found[l] = 1;
s[l] = t;
}
answer(s, d);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |