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