# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730308 | Desh03 | Cave (IOI13_cave) | C++17 | 53 ms | 340 KiB |
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 v[n], d[n];
int f = 0;
while (f != n) {
int l = f, r = n - 1;
int s[n];
for (int i = 0; i < n; i++) {
if (d[i]) s[i] = v[i];
else s[i] = 0;
}
int x = tryCombination(s), to_check;
if (x == f) to_check = 0;
else to_check = 1;
for (int i = 0; i < n; i++) {
if (d[i]) s[i] = v[i];
else s[i] = to_check;
}
while (l < r) {
int m = l + r >> 1;
for (int i = l; i <= m; i++)
if (!d[i]) s[i] ^= 1;
x = tryCombination(s);
if (x != f) {
for (int i = l; i <= m; i++)
if (!d[i]) s[i] ^= 1;
r = m;
} else l = m + 1;
}
v[l] = to_check, d[l] = f++;
}
answer(v, d);
}
Compilation message (stderr)
# | 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... |