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