# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
148048 | GodTe | 동굴 (IOI13_cave) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
void exploreCave(int N){
int ans[5010] = {0,};
int cntd[5010] = {0,};
rep(i,5010){
ans[i] = 0; cntd[i] = -1;
}
rep(i,N){
int l = 0; int r = N-1;
while(l < r){
int mid = (l+r)/2;
for(int j = l; j <= mid; j++){
if(cntd[j] == -1) ans[j] = 1-ans[j];
}
if(tryCombination(ans) > i) r = mid;
else {
for(int j = l; j <= r; j++) if(cntd[j] == -1) ans[j] = 1-ans[j];
l = mid+1;
}
}
cntd[l] = i;
}
answer(ans,cntd);
}