제출 #395964

#제출 시각아이디문제언어결과실행 시간메모리
395964phathnv동굴 (IOI13_cave)C++11
100 / 100
1049 ms652 KiB
#include "cave.h" void exploreCave(int n) { int res[n], s[n], d[n]; for(int i = 0; i < n; i++) res[i] = -1; for(int pos = 0; pos < n; pos++){ for(int i = 0; i < n; i++) s[i] = (res[i] != -1? res[i] : 0); int trueVal = (tryCombination(s) == pos); int l = 0, r = n - 1; while (l < r){ int mid = (l + r) >> 1; for(int i = 0; i < n; i++) if (res[i] != -1) s[i] = res[i]; else if (l <= i && i <= mid) s[i] = trueVal; else s[i] = trueVal ^ 1; if (tryCombination(s) != pos) r = mid; else l = mid + 1; } res[l] = trueVal; d[l] = pos; } answer(res, 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...