제출 #1014994

#제출 시각아이디문제언어결과실행 시간메모리
1014994Mardonbekhazratov동굴 (IOI13_cave)C++17
0 / 100
346 ms348 KiB
#include "cave.h" #include<iostream> const int maxN=5e3+1; int n; int S[maxN],D[maxN]; void solve(int x){ for(int i=0;i<n;i++){ if(D[i]==-1) S[i]=0; } int ans=tryCombination(S); if(ans==x){ int l=0,r=n-1; while(r>l){ int mid=(l+r)/2; for(int j=0;j<=mid;j++){ if(D[j]==-1) S[j]=1; } if(tryCombination(S)==x+1) r=mid; else l=mid+1; for(int j=0;j<=mid;j++){ if(D[j]==-1) S[j]=0; } } D[l]=x; S[l]=0; return; } int l=0,r=n-1; while(r>l){ int mid=(l+r)/2; for(int j=0;j<=mid;j++){ if(D[j]==-1) S[j]=1; } if(tryCombination(S)==x) r=mid; else l=mid+1; for(int j=0;j<=mid;j++){ if(D[j]==-1) S[j]=0; } } D[l]=x; S[l]=1; } void exploreCave(int N) { n=N; for(int i=0;i<n;i++) D[i]=-1,S[i]=-1; for(int i=0;i<n;i++){ solve(i); } 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...