Submission #544160

#TimeUsernameProblemLanguageResultExecution timeMemory
544160krit3379Cave (IOI13_cave)C++14
12 / 100
188 ms504 KiB
#include<bits/stdc++.h> using namespace std; #include"cave.h" #define N 5005 int s[N],ans[N]; void exploreCave(int n){ int i,j,l,r,mid,flag,now; for(i=0;i<n;i++)ans[i]=-1; for(i=0;i<n;i++){ l=0,r=n-1; flag=(tryCombination(s)==i); while(l<=r){ mid=(l+r)/2; for(j=l;j<=mid;j++)if(ans[j]==-1)s[i]=1; now=(tryCombination(s)==i); for(j=l;j<=mid;j++)if(ans[i]==-1)s[i]=0; if(flag==now)l=mid+1; else r=mid-1; } ans[l]=i,s[i]=flag; } answer(s,ans); return ; }
#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...