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>
using namespace std;
#include"cave.h"
#define N 5005
int s[N],ans[N];
void exploreCave(int n){
int i,j,l,r,mid,flag,now;
for(i=0;i<n;i++)ans[i]=-1;
for(i=0;i<n;i++){
l=0,r=n-1;
flag=(tryCombination(s)==i);
while(l<r){
mid=(l+r)/2;
for(j=l;j<=mid;j++)if(ans[j]==-1)s[i]=1;
now=(tryCombination(s)==i);
for(j=l;j<=mid;j++)if(ans[i]==-1)s[i]=0;
if(flag==now)l=mid+1;
else r=mid;
}
ans[l]=i,s[i]=flag;
}
answer(s,ans);
return ;
}
# | 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... |