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"
using namespace std;
void exploreCave(int N) {
int b[N];
int ans[N];
for (int i = 0; i < N; i++)
{
b[i] = 0;
ans[i] = -1;
}
for (int i = 0; i < N; i++)
{
int f = tryCombination(b);
if (f !=i)
{
for (int j = 0; j < N; j++)
{
if (ans[j]==-1) b[j] = 1-b[j];
}
}
int curr = 0;
for (int j = 12; j >= 0; j--)
{
for (int k = curr; k < curr + (1<<j) && k <N; k++)
{
if (ans[k]==-1) b[k] = 1-b[k];
}
int h = tryCombination(b);
for (int k = curr; k < curr + (1<<j) && k <N; k++)
{
if (ans[k]==-1) b[k] = 1-b[k];
}
if (h != i) continue;
curr += 1<<j;
}
b[curr] = 1-b[curr];
ans[curr] = i;
}
answer(b, ans);
}
# | 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... |