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 sta[5000] = {}, dor[5000] = {};
for (int tar = 0; tar < n; tar++)
{
int ask[5000];
for (int i = 0; i < 5000; i++)
if (sta[i])
ask[i] = sta[i] - 1;
else
ask[i] = 1;
int ret = tryCombination(ask);
bool suc;
if (ret == -1 || ret > tar)
suc = true;
else
suc = false;
int l = 0, r = n - 1;
while (l != r)
{
int m = (l + r) / 2;
for (int i = 0; i < n; i++)
if (sta[i])
ask[i] = sta[i] - 1;
else if (l <= i && i <= m)
ask[i] = suc;
else
ask[i] = !suc;
ret = tryCombination(ask);
if (ret == -1 || ret > tar)
r = m;
else
l = m + 1;
}
sta[l] = suc + 1;
dor[l] = tar;
}
for (int i = 0; i < n; i++)
sta[i]--;
answer(sta, dor);
}
# | 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... |