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;
const int MAXN = 5e3 + 10;
int certo[MAXN], atual[MAXN], posCerto[MAXN], alav[MAXN], door[MAXN];
void exploreCave(int N) {
for (int i = 0; i < N; i++) {certo[i] = -1; atual[i] = -1; posCerto[i] = -1; alav[i] = -1; door[i] = -1;}
for (int n = 0; n < N; n++)
{
for (int i = 0; i < N; i++) atual[i] = (posCerto[i] == -1) ? 0 : posCerto[i];
int aux = tryCombination(atual);
if (aux > n) certo[n] = 0;
else certo[n] = 1;
for (int i = 0; i < N; i++) atual[i] = (posCerto[i] == -1) ? certo[n] : posCerto[i];
int ini = 0; int fim = N-1;
while (ini < fim)
{
int m = (ini + fim) / 2;
for (int i = m+1; i <= fim; i++) atual[i] = (posCerto[i] == -1) ? (1 - certo[n]) : posCerto[i];
int aux = tryCombination(atual);
if (aux > n) fim = m;
else ini = m+1;
}
alav[n] = fim;
door[fim] = n;
posCerto[fim] = certo[n];
}
answer(posCerto, door);
}
# | 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... |