Submission #587121

#TimeUsernameProblemLanguageResultExecution timeMemory
587121yutabiCave (IOI13_cave)C++14
100 / 100
801 ms656 KiB
#include "cave.h" int c[5000]; int d[5000]; int s[5000]; void exploreCave(int N) { for(int i=0;i<N;i++) { c[i]=-1; } for(int i=0;i<N;i++) { for(int j=0;j<N;j++) { s[j]=c[j]; if(s[j]==-1) { s[j]=0; } } int res=tryCombination(s); if(res==-1) { res=N; } int correct=1; if(res>i) { correct=0; } int l=0; int r=N-1; while(l!=r) { int m=(l+r)/2; for(int j=0;j<N;j++) { s[j]=c[j]; if(s[j]==-1) { if(j<=m) { s[j]=correct; } else { s[j]=(correct+1)%2; } } } res=tryCombination(s); if(res==-1) { res=N; } if(res>i) { r=m; } else { l=m+1; } } c[l]=correct; d[l]=i; } answer(c,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...