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 s[2][6000][6000],n,a[6000],x[6000],y[6000],o[6000],z[6000];
int bin(int l,int r,int u,int q)
{
if(l==r)
return l;
int mid=(l+r)/2;
for(int i=0;i<n;i++)
{
if(i>=l && i<=mid)
a[i]=q;
else
a[i]=1-q;
}
for(int i=0;i<u;i++)
a[x[i]]=y[i];
int t=tryCombination(a);
if(t==-1 || t>u)
bin(l,mid,u,q);
else
bin(mid+1,r,u,q);
}
void exploreCave(int N)
{
n=N;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
a[j]=0;
for(int j=0;j<i;j++)
a[x[j]]=y[j];
int t=tryCombination(a);
if(t==-1 || t>i)
y[i]=0;
else
y[i]=1;
x[i]=bin(0,n-1,i,y[i]);
o[x[i]]=i;
z[x[i]]=y[i];
}
answer(z,o);
}
Compilation message (stderr)
cave.cpp: In function 'int bin(int, int, int, int)':
cave.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | 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... |