Submission #430456

#TimeUsernameProblemLanguageResultExecution timeMemory
430456Popax21The Big Prize (IOI17_prize)C++17
20 / 100
1 ms404 KiB
#include <assert.h> #include "prize.h" std::pair<int, int> query(int p) { std::vector<int> r = ask(p); return std::make_pair(r[0], r[1]); } int binsearch(int l, int r) { assert(l < r); if(l == r-1) return l; int m = l + (r-l) / 2; auto[lc, rc] = query(m); if(lc == 0 && rc == 0) return m; if(lc != 0) return binsearch(l, m); else if(rc != 0) return binsearch(m+1, r); else assert(false); } int find_best(int n) { return binsearch(0, n); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...