Submission #890251

#TimeUsernameProblemLanguageResultExecution timeMemory
890251kokoueCave (IOI13_cave)C++14
12 / 100
383 ms544 KiB
#include "cave.h" int bt[5001]; int used[5001]; bool used_key[5001]; void exploreCave(int N) { for(int i=0;i<N;i++) { used[i]=-1; } int l=0,r=N-1; for(int j=0;j<N;j++) { l=0; r=N-1; // int mid=(l+r)/2; bool fl=0; for(int i=0;i<N;i++) { if(used_key[i]==0) bt[i]=0; } int curr=tryCombination(bt); if(curr==j) fl=1; while(l!=r) { int mid=(l+r)/2; for(int i=0;i<N;i++) { if(used_key[i]==0) bt[i]=0; } for(int i=l;i<=mid;i++) { if(used_key[i]==0) bt[i]=1; } if((tryCombination(bt)!=j)!=fl) { l=mid+1; } else { // l=mid+1; r=mid; } } used[j]=l; used_key[l]=true; if(fl==1) bt[l]=1; else bt[l]=0; // printf("%dth bit is %d and used[%d]=%d\n",l,bt[l],j,used[j]); } answer(bt,used); }
#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...