제출 #1014996

#제출 시각아이디문제언어결과실행 시간메모리
1014996Mardonbekhazratov동굴 (IOI13_cave)C++17
0 / 100
111 ms564 KiB
#include "cave.h" #include<iostream> const int maxN=5e3+1; int n; int S[maxN],D[maxN]; void solve(int x){ int ans=tryCombination(S); if(ans==-1){ return; } 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; // std::cout<<mid<<' '<<x<<'\n'; 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]=0; 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...