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"
int c[5000];
int d[5000];
int s[5000];
void exploreCave(int N)
{
for(int i=0;i<N;i++)
{
c[i]=-1;
}
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
{
s[j]=c[j];
if(s[j]==-1)
{
s[j]=0;
}
}
int res=tryCombination(s);
if(res==-1)
{
res=N;
}
int correct=1;
if(res>i)
{
correct=0;
}
int l=0;
int r=N-1;
while(l!=r)
{
int m=(l+r)/2;
for(int j=0;j<N;j++)
{
s[j]=c[j];
if(s[j]==-1)
{
if(j<=m)
{
s[j]=correct;
}
else
{
s[j]=(correct+1)%2;
}
}
}
res=tryCombination(s);
if(res==-1)
{
res=N;
}
if(res>i)
{
r=m;
}
else
{
l=m+1;
}
}
c[l]=correct;
d[l]=i;
}
answer(c,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... |