# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
393206 | Gamma | Cave (IOI13_cave) | C++14 | 13 ms | 444 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>
void exploreCave(int N)
{
int s[N], d[N], a[N], y;
memset(d, -1, sizeof d);
for(int i = 0; i < N; i++)
{
memset(a, 0, sizeof a);
for(int j = 0; j < i; j++)
{
a[j] = s[d[j]];
}
y = tryCombination(a);
if(y < i && y != -1)
{
int S = i, e = N - 1, mid;
while(S <= e)
{
mid = (S + e) / 2;
for(int j = S; j < mid; j++)
{
a[j] = 1;
}
y = tryCombination(a);
if(y < i && y != -1)
{
a[mid] = 1;
y = tryCombination(a);
if(y < i && y != -1)
{
S = mid + 1;
}
else
{
d[i] = mid;
s[mid] = 1;
break;
}
}
else
{
e = mid - 1;
for(int j = S; j < mid; j++)
{
a[j] = 0;
}
}
}
}else
{
int S = i, e = N - 1, mid;
while(S <= e)
{
mid = (S + e) / 2;
for(int j = S; j < mid; j++)
{
a[j] = 1;
}
y = tryCombination(a);
if(y < i && y != -1)
{
e = mid - 1;
for(int j = S; j < mid; j++)
{
a[j] = 0;
}
}
else
{
a[mid] = 1;
y = tryCombination(a);
if(y < i && y != -1)
{
d[i] = mid;
s[mid] = 1;
break;
}
else
{
S = mid + 1;
}
}
}
}
}
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... |