이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
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;
}
for(int i = 0;i < N;i++)
{
if(st[i] == 0)
{
pos[N-1] = i;
last = tryCombination(direction);
if(last == -1)answer(direction,pos);
direction[i] = (direction[i] + 1) % 2;
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... |