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 st[N]={0},direction[N]={0},pos[N]={0};
int last = tryCombination(direction);
for(int i = 0;i < N-1;i++)
{
int left = 0,right = N-1;
while(left != right)
{
int mid = (left + right) / 2;
for(int j = left;j < mid;j++)if(st[i] == 0)direction[i] = (direction[i] + 1) % 2;
int x = tryCombination(direction);
if((x > i && last > i) || (x <= i && last <= i))left = mid+1;
else right = mid;
last = x;
}
if(last <= i)direction[left] = (direction[left] + 1) % 2;
st[left] = 1;
pos[i] = left;
}
answer(direction,pos);
}
# | 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... |