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;
bool visited[5005];
int doorIisOpendBy[5005];
int c[5005];
void exploreCave(int N) {
int S[N];
for (int i = 0 ; i < N ; i++){
for (int j = 0 ; j < N ; j++){
if (visited[j] == false){
S[j] = 1;
}
}
bool close = 0;
int last = tryCombination(S);
if (last == i){
close = 1;
for (int j = 0 ; j < N ; j++){
if (visited[j] == false){
S[j] = 0;
}
}
}
int low = 0;
int high = N - 1;
while(low < high){
int mid = (low + high)/2;
for (int j = low ; j <= mid ; j++){
if (visited[j] == false){
S[j] = close;
}
}
for (int j = mid + 1 ; j <= high ; j++){
if (visited[j] == false){
S[j] = (!close);
}
}
last = tryCombination(S);
if (last == i){
high = mid;
}
else {
low = mid + 1;
}
}
visited[low] = true;
doorIisOpendBy[low] = i;
c[low] = (!close);
}
answer(c , doorIisOpendBy);
}
# | 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... |