Submission #981439

#TimeUsernameProblemLanguageResultExecution timeMemory
981439batsukh2006Cave (IOI13_cave)C++17
0 / 100
203 ms536 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int N){ int pos[N],ans[N]; vector<bool> vis(N); memset(pos,0,sizeof(pos)); for(int i=0; i<N; i++){ int tmp=0,p=0; if(tryCombination(pos)==i) tmp=1; int l=0,r=N-1; while(l<=r){ int m=l+(r-l)/2; for(int z=0; z<=m; z++){ if(!vis[z]) pos[z]^=1; } if(tmp){ if(tryCombination(pos)==i) l=m+1,p=pos[m]^1; else r=m-1,p=pos[m]; }else{ if(tryCombination(pos)==i) r=m-1,p=pos[m]^1; else l=m+1,p=pos[m]; } } l--; vis[l]=1; ans[l]=i; pos[i]=p; } answer(pos,ans); }
#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...