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>
using namespace std;
const int maxn = 2e5+10;
void exploreCave(int n)
{
int d[n];
int s[n];
bool vis[n];
memset(vis,0,sizeof vis);
memset(s,0,sizeof s);
int idx=0;
while(idx<n)
{
for(int i=0;i<n;i++)
{
if(vis[i])continue;
s[i]=0;
}
int p=tryCombination(s);
int tip;
if(p==idx)
{
tip=1;
}
else
{
tip=0;
}
int l=0;
int r=n-1;
while(l<r)
{
int mid=l+(r-l)/2;
if(tip==1)
{
for(int i=0;i<n;i++)
{
if(vis[i])continue;
s[i]=0;
}
for(int i=0;i<=mid;i++)
{
if(vis[i])continue;
s[i]=1;
}
}
else
{
for(int i=0;i<n;i++)
{
if(vis[i])continue;
s[i]=1;
}
for(int i=0;i<=mid;i++)
{
if(vis[i])continue;
s[i]=0;
}
}
int poz=tryCombination(s);
if(poz==idx)
{
l=mid+1;
}
else
{
r=mid;
}
}
d[idx]=l;
s[l]=tip;
vis[l]=true;
idx++;
}
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... |