# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
648711 | tigar | 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 "cave.h"
#include <bits/stdc++.h>
void exploreCave(int N)
{
int combos[2][N];
int door[N];
bool check[N];
for(int i=0; i<N; i++){combos[0][i]=0; combos[1][i]=1; check[i]=false;}
for(int i=0; i<N; i++)
{
int bol=1;
int xx=tryCombination(combos[0]);
if(xx>i or xx==-1)bol=0;
int l=0, r=N, midd=N/2;
while(l<=r)
{
for(int j=0; j<N; j++)
{
if((j>=midd or j<l) and !check[j])combos[bol][j]=abs(bol-1);
else if((j<midd and j>=l) and !check[j])combos[bol][j]=bol;
}
int br=tryCombination(combos[bol]);
if(l==r){check[l]=true; combos[0][l]=bol; combos[1][l]=bol; door[l]=i; break;}
else if(br>i or br==-1){r=midd-1; midd=(l+r)/2;}
else {l=midd+1; midd=(l+r)/2;}
}
}
return answer(combos[0], door);
}
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}