제출 #587121

#제출 시각아이디문제언어결과실행 시간메모리
587121yutabi동굴 (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...