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 s[n], known[n], whereto[n];
for(int i = 0; i < n; i++){
known[i] = -1;
}
for(int i = 0; i < n; i++){ // minden ajtora
for(int j = 0; j < n; j++){
s[j] = max(known[j], 0);
}
int g = tryCombination(s);
bool door = (g == -1 || g > i + 1);
int l = 0, r = n - 1;
while(l < r){
int mid = (l + r) / 2;
for(int j = 0; j < n; j++){
if(known[j] > -1){
s[j] = known[j];
}
else{
if(l <= j && j <= mid){
s[j] = door;
}
if(mid < j && j <= r){
s[j] = (1 - door);
}
}
}
int res = tryCombination(s);
if(res == - 1 || res > i + 1){
r = mid;
}
else{
l = mid + 1;
}
}
whereto[l] = i;
known[l] = door;
}
answer(known, whereto);
}
# | 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... |