Submission #855714

#TimeUsernameProblemLanguageResultExecution timeMemory
855714_uros9Cave (IOI13_cave)C++17
0 / 100
25 ms604 KiB
#include "cave.h" #include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN=5009; int g_d[MAXN],i_odkljucava[MAXN]={0},probaj[MAXN],vrata_br[MAXN]; bool checked[MAXN]={0}; int n; void kojeg_odkljucava(int br,int l,int d){ if(l==d){ i_odkljucava[l]=br; g_d[l]=vrata_br[br]; checked[l]=true; return; } int s=(l+d)/2; for(int i=0; i<n; i++){ if(checked[i]){ probaj[i]=g_d[i]; continue; } probaj[i]=1-vrata_br[br]; } for(int i=l; i<=s; i++){ if(checked[i]){ probaj[i]=g_d[i]; continue; } probaj[i]=vrata_br[br]; } int ans=tryCombination(probaj); if(ans==-1||ans>=br) kojeg_odkljucava(br,l,s); else kojeg_odkljucava(br,s+1,d); } void resavaj_za(int br){ for(int i=0; i<n; i++){ if(checked[i]){ probaj[i]=g_d[i]; continue; } probaj[i]=0; } int ans=tryCombination(probaj); if(ans==-1||ans>=br) vrata_br[br]=0; else vrata_br[br]=1; } void exploreCave(int N) { n=N; for(int i=0; i<n; i++){ resavaj_za(i); } answer(g_d,i_odkljucava); }
#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...