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