Submission #599035

#TimeUsernameProblemLanguageResultExecution timeMemory
599035alirezasamimi100Cave (IOI13_cave)C++17
100 / 100
968 ms468 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int n) { int a[n],s[n],d[n]; memset(d,-1,sizeof d); for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(d[j]==-1) a[j]=0; else a[j]=s[j]; } int x; if(tryCombination(a)!=i) x=0; else x=1; int l=0,r=n; while(r-l>1){ int m=(l+r)>>1; for(int j=0; j<m; j++){ if(d[j]==-1) a[j]=1-x; else a[j]=s[j]; } for(int j=m; j<n; j++){ if(d[j]==-1) a[j]=x; else a[j]=s[j]; } if(tryCombination(a)==i) r=m; else l=m; } s[l]=x; d[l]=i; } 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...