제출 #829736

#제출 시각아이디문제언어결과실행 시간메모리
829736nnin동굴 (IOI13_cave)C++14
100 / 100
246 ms524 KiB
#include "cave.h" #include <iostream> using namespace std; int s[6000], d[6000], n; bool sure[6000], to = 1; void change(int l, int r) { for(int i=l;i<=r;i++) { if(!sure[i]) s[i] = 1-s[i]; } } int SwitchForDoor(int door) { int cur = tryCombination(s); if(cur>door || cur==-1) { to = !to; change(0, n-1); } int l = 0, r = n-1; while(l<r) { int m = (l+r)/2; change(l, m); cur = tryCombination(s); change(l, m); if(cur>door || cur==-1) { r = m; } else { l = m+1; } } return l; } void exploreCave(int N) { n = N; for(int i=0;i<n;i++) { int sw = SwitchForDoor(i); d[sw] = i; sure[sw] = true; s[sw] = to; } 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...