제출 #632576

#제출 시각아이디문제언어결과실행 시간메모리
632576Stavab동굴 (IOI13_cave)C++14
0 / 100
129 ms356 KiB
#include "cave.h" void exploreCave(int n) { int S[n], D[n]; for(int i = 0; i < n; i++) { S[i] = 0; D[i] = -1; } int cur, prev; for(int i = 0; i < n; i++) { cur = tryCombination(S); if(cur > i || cur == -1) prev = 1; else prev = 0; int low = 0; int high = n - 1; while(high - low > 1) { int middle = (low + high) / 2; for(int j = low; j <= middle; j++) { if(D[j] == -1) { if(S[j] == 0) S[j] = 1; else S[j] = 0; } } cur = tryCombination(S); if(cur > i || cur == -1) cur = 1; else cur = 0; if(cur == prev) low = middle; else high = middle; prev = cur; } if(D[low] == -1) { if(S[low] == 0) S[low] = 1; else S[low] = 0; cur = tryCombination(S); if(cur == prev) { D[high] = i; if(cur == i) { if(S[high] == 0) S[high] = 1; else S[high] = 0; } } else { D[low] = i; if(cur == i) { if(S[low] == 0) S[low] = 1; else S[low] = 0; } } } else { D[high] = i; cur = tryCombination(S); if(cur == i) { if(S[high] == 0) S[high] = 1; else S[high] = 0; } } } answer(S, 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...