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 A[5000], Pos[5000], Fin[5000];
void exploreCave(int n){
for(int i=0; i<n; i++){
int l = 0, r = n-1;
int now = tryCombination(A); if(now == -1) now = 1e9;
assert(now >= i);
while(l < r){
int m = (l + r) / 2;
for(int j=l; j<=m; j++) if(!Fin[j]) A[j] ^= 1;
int t = tryCombination(A); if(t == -1) t = 1e9;
for(int j=l; j<=m; j++) if(!Fin[j]) A[j] ^= 1;
if((now > i) != (t > i)) r = m;
else l = m + 1;
}
Pos[r] = i; Fin[r] = 1;
if(now <= i) A[r] ^= 1;
}
answer(A, Pos);
}
# | 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... |