이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
# include "cave.h"
using namespace std;
int n,pr[100005],x[100005],le,ri,mid,pre[1000005],k,ans[1000005],idx,w;
void exploreCave(int N)
{
n=N;
for (int i=0; i<n; i++)
pre[i]=-1;
for (int i=0; i<n; i++)
{
for (int j=0; j<n; j++)
{
if (pre[i]==-1)
x[i]=1;
else
x[i]=pre[i];
}
idx=tryCombination(x);
if (idx>i || idx==-1)
k=1;
else k=0;
le=0;
ri=n-1;
while (le<ri)
{
mid=(le+ri)/2;
for (int j=le; j<=mid; j++)
{
if(pre[i]==-1) x[i]=k;
else x[i]=pre[i];
}
for(int j=0; j<le; j++)
{
if (pre[j]==-1)
{
if (k==1)
{
x[j]=0;
}
else
x[j]=1;
}
else
x[j]=pre[j];
}
for (int j=mid+1; j<n; j++)
{
if (pre[j]==-1)
{
if (k==1)
{
x[j]=0;
}
else
x[j]=1;
}
else
x[j]=pre[j];
}
idx=tryCombination(x);
if(idx>i || idx==-1)
ri=mid;
else
le=mid+1;
}
mid=(le+ri)/2;
w=mid;
ans[mid]=i;
pre[mid]=k;
}
answer(pr,ans);
}
# | 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... |