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"
using namespace std;
void exploreCave(int n) {
int d_[n], s_[n];
memset(d_, -1, sizeof(d_));
memset(s_, -1, sizeof(s_));
for (int i = 0; i < n; i++) {
int s[n] = {};
for (int j = 0; j < n; j++) {
if (s_[j] != -1)
s[j] = s_[j];
}
int x = tryCombination(s);
int l = 0, h = n - 1, ans = -1;
while (l <= h) {
int temp[n];
for (int j = 0; j < n; j++)
temp[j] = s[j];
int mid = (l + h) / 2;
for (int j = l; j <= mid; j++)
temp[j] = d_[j] == -1 ? 1 : s[j];
int y = tryCombination(temp);
if ((x == i && y != i) || (x != i && y == i))
ans = mid, h = mid - 1;
else
l = mid + 1;
}
s_[ans] = x == i;
}
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... |