제출 #870500

#제출 시각아이디문제언어결과실행 시간메모리
870500AtabayRajabli동굴 (IOI13_cave)C++17
0 / 100
458 ms508 KiB
#include "cave.h" void exploreCave(int n) { int a[n], b[n], used[n], d[n]; for(int i = 0; i<n; i++) { a[i] = 0; b[i] = 0; used[i] = 0; } int l, r, mid; for(int i = 0; i<n; i++) { l = 0, r = n-1; int q = tryCombination(b); if(q == -1)q = n; while(l < r) { mid = (l + r) / 2; for(int i = 0; i<n; i++) { if(used[i])continue; if(mid+1 <= i && i <= r)b[i] ^= 1; else b[i] = 0; } int k = tryCombination(b); if(k == -1)k = n; if((q == i && k > i) || (q > i && k == i))l = mid + 1; else r = mid; } d[i] = l; if(q == i)a[l] = !a[l]; b[l] = a[l]; used[l] = 1; for(int i = 0; i<n; i++)if(!used[i])b[i] = 0; } answer(a, 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...