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[69420];
int ans[60420];
std::vector <int> b(n), vis(n, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) if (!vis[j]) a[j] = 0;
int cur = tryCombination(a);
int now = cur == -1 || cur > i ? 0 : 1;
int l = 0, r = n - 1;
while (l <= r) {
int mid = (l + r) >> 1;
for (int j = 0; j < n; j++) if (!vis[j]) a[j] = j <= mid ? now : 1 - now;
int comp = tryCombination(a);
if (comp == -1 || comp > i) b[i] = mid, r = mid - 1;
else l = mid + 1;
}
a[b[i]] = now;
vis[b[i]] = 69;
ans[b[i]] = i;
}
answer(a, 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... |