Submission #812747

#TimeUsernameProblemLanguageResultExecution timeMemory
812747KerimCave (IOI13_cave)C++17
100 / 100
1000 ms448 KiB
#include "cave.h" #include "bits/stdc++.h" using namespace std; void exploreCave(int n) { vector<int>a(n),b(n); for(int i=0;i<n;i++)a[i]=-1; for(int i=0;i<n;i++){ vector<int> c(n, 0); for(int j=0;j<n;j++) if(~a[j]) c[j]=a[j]; int val=(tryCombination(c.data())==i); int st=0,en=n-1; while(st<en){ int mid=(st+en+1)>>1; for(int j=0;j<n;j++) if(a[j] == -1) c[j]=val^(j<mid); if(tryCombination(c.data())==i) en=mid-1; else st=mid; } a[st]=val; b[st]=i; } answer(a.data(),b.data()); }
#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...