이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int s[5005],d[5005],ret;
bool used[5005],prevdopen,dopen;
void exploreCave(int n) {
memset(d,-1,sizeof(d));
memset(used,0,sizeof(used));
ret=tryCombination(s);
for(int j=0;j<n-1;j++){
if(ret==-1||ret>j)
prevdopen=1;
else
prevdopen=0;
int l=-1,r=n;
while(r-l>1){
int m=(l+r)/2;
for(int i=l+1;i<=m;i++){
if(used[i])
continue;
s[i]=!s[i];
}
ret=tryCombination(s);
if(ret==-1||ret>j)
dopen=1;
else
dopen=0;
if(dopen==prevdopen)
l=m;
else
r=m;
prevdopen=dopen;
}
d[r]=j;
used[r]=1;
if(!dopen){
s[r]=!s[r];
ret=tryCombination(s);
}
}
answer(s,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... |