제출 #108402

#제출 시각아이디문제언어결과실행 시간메모리
108402Diuven동굴 (IOI13_cave)C++14
100 / 100
1501 ms532 KiB
#include "cave.h" #include <vector> using std::vector; int A[5010], B[5010], n; int ask(int S[]){ int res = tryCombination(S); return res<0 ? 12345 : res; } int ask(int l, int r, int x){ static int S[5010]; for(int i=0; i<n; i++) S[i] = (A[i]>=0 ? A[i] : (l<=i && i<=r ? x : 1-x)); return ask(S); } void exploreCave(int N) { n = N; for(int i=0; i<n; i++) A[i] = B[i] = -1; for(int i=0; i<n; i++){ // 다 끄고 물어봤을 때, i번째가 열렸으면 0; int state = (i>=ask(-1, -1, 1)); int s=0, e=n-1; while(s<e){ int mid = (s+e)/2; if(i<ask(0, mid, state)) e = mid; else s = mid+1; } B[s] = i, A[s] = state; } answer(A, B); }
#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...