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>
using namespace std;
void exploreCave(int n) {
int a[n],s[n],d[n];
memset(d,-1,sizeof d);
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(d[j]==-1) a[j]=0;
else a[j]=s[j];
}
int x;
if(tryCombination(a)!=i) x=0;
else x=1;
int l=0,r=n;
while(r-l>1){
int m=(l+r)>>1;
for(int j=0; j<m; j++){
if(d[j]==-1) a[j]=1-x;
else a[j]=s[j];
}
for(int j=m; j<n; j++){
if(d[j]==-1) a[j]=x;
else a[j]=s[j];
}
if(tryCombination(a)==i) r=m;
else l=m;
}
s[l]=x;
d[l]=i;
}
answer(s,d);
}
# | 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... |