이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include "cave.h"
int currentd,high,low,mid;
int dstate,prevs,result;
void exploreCave(int N) {
int D[N], A[N];
bool known[N];
currentd = 0;
high = N;
low = -1;
memset(known,0,sizeof known);
for (int i =0;i<N;i++) D[i] = -1;
for (int i =0;i<N;i++) A[i] = 0;
result = tryCombination(A);
for (;currentd < N;currentd++) {
//1 is open 0 is close
if (result == -1 or result > currentd) {
prevs = 1;
}
while (high - low > 1) {
mid = (high+low)/2;
//< or <=?
for (int i = max(0,low);i<=mid;i++) {
if (known[i]) continue;
A[i] = !A[i];
}
result = tryCombination(A);
if (result == -1 or result > currentd) dstate = 1;
else dstate = 0;
if (dstate == prevs) low = mid;
else high = mid;
prevs = dstate;
}
known[high] = true;
if (!prevs) A[high] = !A[high];
D[high] = currentd;
}
answer(A,D);
}
# | 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... |