Submission #316085

#TimeUsernameProblemLanguageResultExecution timeMemory
316085MrDominoThe Big Prize (IOI17_prize)C++14
20 / 100
69 ms384 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; mt19937 rng((long long) (new char)); int rn(int l, int r) { return l + rng() % (r - l + 1); } int rep(int l, int r) { if (l > r) return 0; int i = rn(l, r); ///int i = (l + r) / 2; vector<int> v = ask(i); if (v[0] == 0 && v[1] == 0) return i; if (v[0] > v[1]) { int x = rep(l, i - 1); if (x || v[1] == 0) { return x; } else { return rep(i + 1, r); } } else { int x = rep(i + 1, r); if (x || v[0] == 0) { return x; } else { return rep(l, i - 1); } } } int find_best(int n) { return rep(0, n - 1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...