# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
648937 | tigar | Cave (IOI13_cave) | C++14 | 331 ms | 400 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>
#include "cave.h"
using namespace std;
bool check[5050];
int combs[5050], doors[5050];
void exploreCave(int n)
{
for(int br=0; br<n; br++)
{
for(int i=0; i<n; i++)
if(!check[i])combs[i]=0;
int beg=tryCombination(combs), opening=1;
if(beg>br or beg==-1)opening=0;
int l=0, r=n, midd=n/2;
while(r-l>1)
{
for(int i=0; i<n; i++)
if(!check[i])
if(i<l or i>midd)combs[i]=abs(opening-1);
else combs[i]=opening;
int begg=tryCombination(combs);
if(begg>br or begg==-1){r=midd; midd=(l+r)/2;}
else {l=midd; midd=(l+r)/2;}
}
if(l==r){check[l]=true; doors[l]=br; combs[l]=opening;}
else
{
combs[l]=opening; combs[r]=abs(opening-1);
int xx=tryCombination(combs);
if(xx>br or xx==-1){check[l]=true; doors[l]=br; combs[l]=opening;}
else {check[r]=true; doors[r]=br; combs[r]=opening;}
}
}
return answer(combs, doors);
}
Compilation message (stderr)
# | 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... |