Submission #294668

#TimeUsernameProblemLanguageResultExecution timeMemory
294668ASDF123The Big Prize (IOI17_prize)C++14
20 / 100
53 ms512 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; int find_best(int n) { int pos = 0; int q = 0; while (1) { q++; assert(q <= 10000); vi pos_res = ask(pos); if (pos_res[0] + pos_res[1] == 0) { return pos; } int l = pos, r = n; while (r - l > 1) { int mid = (l + r) >> 1; q++; assert(q <= 10000); vi mid_res = ask(mid); if (pos_res[0] == mid_res[0] && pos_res[1] == mid_res[1]) { l = mid; } else { r = mid; } } pos = l + 1; } // can't be here for (int i = 0; i < n; i++) { vi res = ask(i); if(res[0] + res[1] == 0) return i; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...