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) {
int corr[n], pos[n];
for (int i=0;i<n;i++) corr[i] = 0, pos[i] = -1;
for (int i=0;i<n;i++) {
int cur = tryCombination(corr);
bool down = (cur==i);
int l = 0, r = n-1;
while (l<r) {
int a[n];
for (int i=0;i<n;i++) a[i] = corr[i];
int mid = (l+r)/2;
for (int j=l;j<=mid;j++) if (pos[j]==-1) a[j] = 1;
cur = tryCombination(a);
if ((cur==i) ^ down) r = mid;
else l = mid+1;
}
pos[l] = i;
corr[l] = down;
}
answer(corr, pos);
}
# | 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... |