제출 #380669

#제출 시각아이디문제언어결과실행 시간메모리
380669ritul_kr_singh동굴 (IOI13_cave)C++17
100 / 100
1153 ms748 KiB
#include "cave.h" void exploreCave(int N){ int ans[N], curr[N], D[N]; for(int &i : ans) i = 2; for(int i=0; i<N; ++i){ for(int j=0; j<N; ++j) curr[j] = ans[j]<2 ? ans[j] : 1; int currRes = tryCombination(curr); bool one = currRes>i or currRes<0; int low = 0, high = N-1; while(low<high){ int mid = (low+high)/2; for(int j=0; j<N; ++j){ if(ans[j]<2) curr[j] = ans[j]; else if(j<=mid) curr[j] = one; else curr[j] = !one; } currRes = tryCombination(curr); if(currRes>i or currRes<0) high = mid; else low = mid+1; } ans[low] = one; D[low] = i; } answer(ans, D); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...