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"
int a[5005];
int b[5005];
int S[5005];
int puerta[5005];
void exploreCave(int N){
int res;
for (int i = 0; i < N; i++){
a[i] = -1;
b[i] = -1;
}
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
if (a[j] != -1){
S[j] = a[j];
}else{
S[j] = 1;
}
}
res = tryCombination(S);
if (res > i or res == -1){
puerta[i] = 1;
}else{
puerta[i] = 0;
}
int ini = 0;
int fin = N;
int mit = (ini + fin) / 2;
while(ini != mit){
for (int j = 0; j < mit; j++){
if (a[j] != -1){
S[j] = a[j];
}else{
S[j] = puerta[i];
}
}
for (int j = mit; j < N; j++){
if (a[j] != -1){
S[j] = a[j];
}else{
S[j] = 1 - puerta[i];
}
}
res = tryCombination(S);
if (res > i or res == -1){
fin = mit;
mit = (ini + fin) / 2;
}else{
ini = mit;
mit = (ini + fin) / 2;
}
}
a[mit] = puerta[i];
b[mit] = i;
}
answer(a, b);
}
# | 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... |