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 s[N], d[N];
memset(s, 0, sizeof(s));
memset(d, -1, sizeof(d));
vector<int> q;
for (int i = 0; i < N; i++)
{
q.push_back(tryCombination(s));
int l = 0, r = N - 1;
while (l < r)
{
int m = (l + r) / 2;
for (int j = l; j <= m; j++)
{
if (d[j] == -1)
s[j] ^= 1;
}
q.push_back(tryCombination(s));
if ((q.back() == i) ^ (q[q.size() - 2] == i))
{
r = m;
}
else
{
l = m + 1;
}
}
d[l] = i;
if (q.back() == i)
s[l] ^= 1;
}
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... |