# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870180 | AtabayRajabli | Cave (IOI13_cave) | C++17 | 44 ms | 348 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"
void exploreCave(int n) {
int q = 0;
int a[n], b[n], ans[n], d[n];
for(int i = 0; i<n; i++)
{
a[i] = 0;
b[i] = 0;
}
int l, r, mid;
for(int i = 0; i<n; i++)
{
l = 0, r = n-1;
int q = tryCombination(a);
while(l <= r)
{
mid = (l + r + 1) / 2;
for(int i = l; i<mid; i++)b[i] = a[i];
for(int i = mid; i<=r; i++)b[i] = !a[i];
int k = tryCombination(b);
if((q == i && k > q) || (q > i && k == i))
{
l = mid;
}
else
{
r = mid - 1;
}
}
d[mid] = i;
if(q > i)ans[i] = a[i];
else ans[i] = !a[i];
}
answer(ans, 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... |