# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
316072 | MrDomino | The Big Prize (IOI17_prize) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
mt19937 rng((long long) (new char));
int find_best(int n) {
/// subtask 1
int l = 0;
while (l < n) {
int r = l, lo = l + 1, hi = n - 1;
vector<int> v_l = ask(r);
if (v_pos[0] == 0 && v_pos[1] == 0) {
return l;
}
while (lo <= hi) {
int pos = (lo + hi) / 2;
vector<int> v_pos = ask(pos);
if (v_pos == v_l) {
r = pos;
lo = pos + 1;
} else {
hi = pos - 1;
}
}
l = r + 1;
}
}