#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
int find_best(int N) {
for (int i = 0; i < 500; i++) {
vector<int> t = ask(i);
if (t[0] + t[1] == 0) {
return i;
}
}
int x = 500;
while (1) {
vector<int> t = ask(x);
if (t[0] + t[1] == 0) {
return x;
}
int lo = x, hi = N - 1;
while (lo < hi) {
int mi = (lo + hi + 1) / 2;
vector<int> v = ask(mi);
if (v[0] >= t[0]) {
lo = mi;
} else {
hi = mi - 1;
}
}
x = lo + 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
292 KB |
Integer 200000 violates the range [0, 199999] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
296 KB |
Integer 200000 violates the range [0, 199999] |
2 |
Halted |
0 ms |
0 KB |
- |