# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
305873 | juggernaut | 동굴 (IOI13_cave) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"cave.h"
#include<bits/stdc++.h>
using namespace std;
int pos[5000],n,tmp[5000],bl[5000],ans[5000],pr;
bool check(int val,int l,int r){
for(int i=l;i<=r;i++)if(!bl[i])ans[i]^=1;
int ret=tryCombination(tmp);
l=pr;
pr=ret;
return (l>=i)^(ret>=i);
}
void exploreCave(int N){
int i=0,l,r,m;
n=N;
for(;i<n;i++){
l=0,r=n-1;
pr=tryCombination(ans);
while(l<r){
m=(l+r)>>1;
if(check(i,l,m))r=m;
else l=m+1;
}
if(pr>=i)ans[l]^=1;
pos[l]=i;
bl[l]=1;
}
answer(ans,pos);
}