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>
#define ll long long
#define endl '\n'
//#define f first
//#define s second
using namespace std;
void exploreCave(int n)
{
int s[n],d[n];
for (int i=0; n>i; i++)
{
s[i] = 0;
d[i] = -1;
}
for (int i=0; n>i; i++)
{
if (tryCombination(s) != i)
{
for (int j=0; n>j; j++)
{
if (d[j] != -1)
continue;
s[j] ^= 1;
}
}
int l = 0 , r = n - 1;
int mid = (l + r) / 2;
int f = s[i];
while (l < r)
{
mid = (l + r) / 2;
for (int j=l; mid>=j; j++)
{
if (d[j] != -1)
continue;
s[j] ^= 1;
}
int l1=l;
if (tryCombination(s) != i)
{
r = mid;
f ^= 1;
}
else
{
l = mid + 1;
}
for (int j=l1; mid>=j; j++)
{
if (d[j] != -1)
continue;
s[j] ^= 1;
}
}
s[i] = f;
d[l] = i;
}
answer(s , d);
}
# | 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... |