# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869101 | AtabayRajabli | Cave (IOI13_cave) | C++17 | 97 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], ans[n], d[n];
for(int i = 0; i<n; i++)
{
a[i] = 0;
}
for(int i = 0; i<n; i++)
{
a[i] ^= 1;
int l = 0, r = n-1, q = tryCombination(a);
if(q == -1)q = n;
while(l <= r)
{
int mid = (l + r) / 2;
a[mid] ^= 1;
int k = tryCombination(a);
if(k == -1)k = n;
if(k == q)
{
r = mid - 1;
a[mid] ^= 1;
}
else if(k < q)
{
l = mid + 1;
a[mid] ^= 1;
}
else if(k == q + 1)
{
d[mid] = q;
break;
}
}
}
answer(a, 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... |