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;
int f(int x){
if(x==-1)return 1e9;
return x;
}
void exploreCave(int n) {
int ans1[n],ans2[n];
memset(ans2,-1,sizeof(ans2));
for(int i=0;i<n;i++){
int a[n],x,y;
for(int j=0;j<n;j++){
if(ans2[j]==-1)a[j]=0;
else a[j]=ans1[j];
}
x=tryCombination(a);
y=x!=i;
for(int j=0;j<n;j++){
if(ans2[j]==-1)a[j]=y;
else a[j]=ans1[j];
}
int l=0,r=n-1;
while(l<r){
int m=(l+r)/2;
for(int j=0;j<n;j++){
if(ans2[j]==-1)a[j]=y^(j<=m);
else a[j]=ans1[j];
}
if(f(tryCombination(a))>i)r=m;
else l=m+1;
}
ans1[l]=y^1;
ans2[l]=i;
}
answer(ans1,ans2);
}
# | 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... |