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"
#define rep(i,a,b) for(int i = a;i < b;i++)
using namespace std;
int correct[25005],porta[25005];
void solve(int low,int high,int cur)
{
if(low == high)
{
correct[low] = (correct[low]+1)%2;
porta[low] = cur;
return;
}
int mid = (low + high) / 2;
rep(i,low,mid+1)
{
if(porta[i] == -1)
{
correct[i] = (correct[i] + 1)%2;
}
}
if(tryCombination(correct) != cur)
{
rep(i,low,mid+1)
{
if(porta[i] == -1)
{
correct[i] = (correct[i] + 1)%2;
}
}
solve(low,mid,cur);
}
else
{
solve(mid+1,high,cur);
}
return;
}
void exploreCave(int N)
{
rep(i,0,N)
{
porta[i] = -1;
}
rep(i,0,N)
{
if(tryCombination(correct) != i)
{
rep(j,0,N)
{
if(porta[j] == -1)
{
correct[j] = (correct[j] + 1)%2;
}
}
}
solve(0,N-1,i);
}
answer(correct,porta);
return;
}
# | 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... |