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;
void exploreCave(int n){
int s[n], d[n];
vector<bool>mark(n);
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 0;
int x = tryCombination(s);
if(x == i){
for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 1;
}
int l = 0, r = n - 1;
int a = 0;
while(l <= r){
int mid = (l + r)/2;
for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1;
int tmp = tryCombination(s);
if(tmp == -1) tmp = n + 1;
if(tmp > i){
a = mid;
l = mid + 1;
} else{
r = mid - 1;
}
for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1;
}
mark[a] = true;
d[a] = 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... |