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