제출 #80098

#제출 시각아이디문제언어결과실행 시간메모리
80098AngelKnows동굴 (IOI13_cave)C++14
0 / 100
234 ms444 KiB
#include "cave.h" bool keep[5005]; int s[5005],d[5005]; void flip(int l,int r) { for (int j=l;j<=r;j++) { if (!keep[j]) s[j]=1-s[j]; } } void exploreCave(int N) { for (int i=1;i<=N;i++) s[i]=0; int x; int l,r,mid; for (int i=1;i<=N;i++) { x=tryCombination(s); if (x!=i) flip(1,N); l=1,r=N; while (l<=r) { mid=(l+r)>>1; flip(l,mid); x=tryCombination(s); if (l==r) { if (x==i) s[l]=1-s[l],keep[l]=1; else keep[l]=1; d[l]=i; break; } if (x!=i) { flip(l,mid); r=mid; } else { l=mid+1; } } } answer(s,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...