Submission #733430

#TimeUsernameProblemLanguageResultExecution timeMemory
733430MauveCave (IOI13_cave)C++14
76 / 100
46 ms432 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int N) { int pos[N],a[N],i,j,l,r,m; for(int i=0;i<=N;i++){ a[i]=0; pos[i]=-1; } if(N<=2000){ for(i=0;i<N;i++){ l=0; r=N-1; while(r-l>1){ bool k=(tryCombination(a)==i); m=(r+l)/2; for(j=l;j<=m;j++) if(pos[j]==-1) a[j]=1-a[j]; if((tryCombination(a)==i)==k) l=m+1; else r=m; } for(j=l;j<=r;j++) if(pos[j]==-1){ bool k=(tryCombination(a)==i); a[j]=1-a[j]; if(k!=(tryCombination(a)==i)){ if(!k) a[j]=1-a[j]; pos[j]=i; break; } } } answer(a,pos); } if(tryCombination(a)==-1){ for(i=0;i<N;i++){ a[i]=1; pos[i]=tryCombination(a); a[i]=0; } answer(a,pos); } for(i=0;i<N;i++){ pos[i]=i; if(tryCombination(a)!=i) a[i]=0; else a[i]=1; } answer(a,pos); }
#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...