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 fixed_[5000];
int match[5000],result[5000],openstate,ak;
void change(int a, int b, bool c){
for(int i=a;i<=b;i++){
if(!fixed_[i])
result[i]= c;
}
}
void exploreCave(int n){
for(int i=0;i<n;i++){
int pocz=0;
int kon=n-1;
change(pocz,kon,1);
ak=tryCombination(result);
if(ak==i)
openstate=0;
else
openstate=1;
while(pocz<kon){
int sr=(pocz+kon)/2;
change(0,sr,openstate);
change(sr+1,n-1,!openstate);
ak=tryCombination(result);
if(ak==i)
pocz=sr+1;
else
kon=sr;
}
result[pocz]=openstate;
match[pocz]=i;
fixed_[pocz]=1;
}
answer(result,match);
}
# | 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... |