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"
void exploreCave(int N){
int ans[N], curr[N], D[N];
for(int &i : ans) i = 2;
for(int i=0; i<N; ++i){
for(int j=0; j<N; ++j)
curr[j] = ans[j]<2 ? ans[j] : 1;
int currRes = tryCombination(curr);
bool one = currRes>i or currRes<0;
int low = 0, high = N-1;
while(low<high){
int mid = (low+high)/2;
for(int j=0; j<N; ++j){
if(ans[j]<2) curr[j] = ans[j];
else if(j<=mid) curr[j] = one;
else curr[j] = !one;
}
currRes = tryCombination(curr);
if(currRes>i or currRes<0) high = mid;
else low = mid+1;
}
ans[low] = one;
D[low] = i;
}
answer(ans, 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... |