This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//chockolateman
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
void exploreCave(int N)
{
int seq[N];
int ans[N];
for(int i =0 ; i < N ; i++)
seq[i] = 0;
bool used[N];
for(int i = 0 ; i < N ; i++)
used[i] = false;
for(int i = 0 ; i < N ; i++)
{
int res = tryCombination(seq);
if(res>i||res==-1)
{
for(int i = 0 ; i < N ; i++)
if(!used[i])
{
if(seq[i])
seq[i] = 0;
else
seq[i] = 1;
}
}
int low = 0;
int high = N-1;
while(high > low)
{
int mid = (low+high)/2;
for(int i = 0 ; i <= mid; i++)
{
if(!used[i])
{
if(seq[i])
seq[i] = 0;
else
seq[i] = 1;
}
}
res = tryCombination(seq);
if(res>i||res==-1)
high = mid;
else
low = mid;
for(int i = 0 ; i <= mid; i++)
{
if(!used[i])
{
if(seq[i])
seq[i] = 0;
else
seq[i] = 1;
}
}
}
if(seq[low])
seq[low] = 0;
else
seq[low] = 1;
used[low] = true;
ans[i] = low;
answer(seq,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... |