# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544155 | krit3379 | Cave (IOI13_cave) | C++14 | 0 ms | 0 KiB |
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 n;
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 ;
}