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>
#define ll long long
using namespace std;
int s[5005]; // switch
int ans[5005];
void exploreCave(int n) {
memset(ans, -1, sizeof(ans));
ll l, r, mid;
bool flag, idk;
for (int i = 0; i < n; i++) {
l = 0, r = n - 1;
flag = (tryCombination(s) == i);
while (l <= r) {
mid = (l + r) / 2;
for (int j = l; j <= mid; j++) if (ans[j] == -1) s[j] = 1;
idk = (tryCombination(s) == i);
for (int j = l; j <= mid; j++) if (ans[j] == -1) s[j] = 0;
if (flag == idk) l = mid + 1;
else r = mid - 1;
}
ans[l] = i, s[l] = flag;
}
answer(s, ans);
}
# | 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... |