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 "prize.h"
#include <bits/stdc++.h>
using namespace std;
int find_best(int N) {
int mx = 0;
for (int i = 0; i < 500; i++) {
vector<int> t = ask(i);
if (t[0] + t[1] == 0) {
return i;
}
mx = max(mx, t[0] + t[1]);
}
int x = 500;
while (1) {
vector<int> t = ask(x);
if (t[0] + t[1] == 0) {
return x;
}
if (t[0] + t[1] != mx) {
x++;
continue;
}
int lo = x, hi = N - 1;
while (lo < hi) {
int mi = (lo + hi + 1) / 2;
vector<int> v = ask(mi);
if (v == t) {
lo = mi;
} else {
hi = mi - 1;
}
}
x = lo + 1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |