#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int bin_search() {
int lo = 0, hi = n - 1;
while (lo != hi) {
int mid = (lo + hi / 2);
vector<int> res = ask(mid);
if (res[0] + res[1] == 0) return mid;
else if (res[0] == 1) hi = mid - 1;
else lo = mid + 1;
}
return lo;
}
int find_best(int tmp_n) {
n = tmp_n;
int ans = bin_search();
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |