# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
632553 | Stavab | Cave (IOI13_cave) | C++14 | 130 ms | 400 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 S[n], D[n];
for(int i = 0; i < n; i++)
{
S[i] = 0;
D[i] = -1;
}
int cur, prev;
for(int i = 0; i < n; i++)
{
cur = tryCombination(S);
if(cur > i || cur == -1)
prev = 1;
else
prev = 0;
int low = 0;
int high = n - 1;
while(high - low > 1)
{
int middle = (low + high) / 2;
for(int j = low; j <= middle; j++)
{
if(D[j] == -1)
{
if(S[j] == 0)
S[j] = 1;
else
S[j] = 0;
}
}
int cur = tryCombination(S);
if(cur > i || cur == -1)
cur = 1;
else
cur = 0;
if(cur == prev)
low = middle;
else
high = middle;
prev = cur;
}
if(D[low] == -1)
{
if(S[low] == 0)
S[low] = 1;
else
S[low] = 0;
cur = tryCombination(S);
if(cur == prev)
{
D[high] = i;
if(cur == i)
{
if(S[high] == 0)
S[high] = 1;
else
S[high] = 0;
}
}
else
{
D[low] = i;
if(cur == i)
{
if(S[low] == 0)
S[low] = 1;
else
S[low] = 0;
}
}
}
else
{
D[high] = i;
cur = tryCombination(S);
if(cur == i)
{
if(S[high] == 0)
S[high] = 1;
else
S[high] = 0;
}
}
}
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... |