제출 #64945

#제출 시각아이디문제언어결과실행 시간메모리
64945gnoor동굴 (IOI13_cave)C++17
100 / 100
1634 ms640 KiB
#include "cave.h" int asking[5010]; bool known[5010]; int config[5010]; int whatd[5010]; int n; void prepare() { for (int i=0;i<n;i++) { if (known[i]) asking[i]=config[i]; } } void set(int l,int r,int val) { for (int i=l;i<=r;i++) { asking[i]=val; } } void clear(int val) { set(0,n-1,val); } void exploreCave(int N) { n=N; for (int i=0;i<n;i++) { clear(0); prepare(); int state=-1; int res; res=tryCombination(asking); if (res>i||res==-1) { state=0; } else { state=1; } int lo=0; int hi=n-1; int mid; while (lo<hi) { mid=(lo+hi)>>1; clear(!state); set(lo,mid,state); prepare(); res=tryCombination(asking); if (res>i||res==-1) { hi=mid; } else { lo=mid+1; } } known[lo]=1; config[lo]=state; whatd[lo]=i; } answer(config,whatd); }
#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...