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 <bits/stdc++.h>
#include <cave.h>
using namespace std;
const long long MX=5e3+10;
int zal[MX],pol[MX];
int n;
void cnt(int in)
{
int zap[n];
for(int i=0;i<n;i++)
{
zap[i]=(pol[i]==-1?0:pol[i]);
}
int rt=tryCombination(zap),ndc;
if(rt>in)
{
ndc=0;
}
else
{
ndc=1;
}
int l=0,r=n-1;
while(l<r)
{
int mid=(l+r)/2;
for(int i=0;i<n;i++)
{
zap[i]=pol[i];
if(zap[i]==-1)
{
if(l<=i && i<=mid)
{
zap[i]=ndc;
}
else
{
zap[i]=(ndc^1);
}
}
}
rt=tryCombination(zap);
if(rt>in)
{
r=mid;
}
else
{
l=mid+1;
}
}
zal[r]=in;
pol[r]=ndc;
}
void exploreCave(int N)
{
n=N;
for(int i=0;i<n;i++)
{
pol[i]=-1;
zal[i]=-1;
}
for(int i=0;i<n;i++)
{
cnt(i);
}
int anspol[n],anszal[n];
for(int i=0;i<n;i++)
{
anspol[i]=pol[i];
anszal[i]=zal[i];
}
answer(anspol,anszal);
}
# | 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... |