Submission #339104

#TimeUsernameProblemLanguageResultExecution timeMemory
339104markussieCave (IOI13_cave)C++17
100 / 100
407 ms640 KiB
#include "cave.h" #include <vector> #include <algorithm> using namespace std; void exploreCave(int n) { vector<int> to(n, -1); vector<int> pos(n, -1); for(int i = 0; i < n; ++i) { vector<int> attemp(n, 0); for(int j = 0; j < n; ++j) if(pos[j] != -1) attemp[j] = pos[j]; int type = tryCombination(attemp.data()) == i; int l = 0, r = n; while(r - l > 1) { int mid = (l + r) / 2; for(int j = l; j < r; ++j) if(pos[j] != -1) attemp[j] = pos[j]; else attemp[j] = type ^ (j >= mid); if(tryCombination(attemp.data()) == i) l = mid; else r = mid; } pos[l] = type; to[l] = i; } answer(pos.data(), to.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...