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 s[N], d[N];
vector<bool> vis(N, false);
memset(s, 0, sizeof s);
memset(d, 0, sizeof d);
int pant, p = tryCombination(s);
int l = 0, r = N-1, mid = (l+r)/2;
for (int k = 0; k < N; k++) {
while (l < r) {
for (int i = l; i <= mid; i++) {
if (!vis[i]) s[i] = !s[i];
}
pant = p;
p = tryCombination(s);
if (p == k && pant == k) l = mid+1;
else if (p != k && pant != k) l = mid+1;
else r = mid;
mid = (l+r)/2;
}
d[r] = k;
vis[r] = true;
if (p == k) s[r] = !s[r];
}
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... |