#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 200200;
vector<int> arr[N];
vector<int> ASK(int p) {
if (arr[p].empty())
arr[p] = ask(p);
return arr[p];
}
int find_best(int n) {
int i = 0;
while (i < n) {
if (ASK(i)[0] + ASK(i)[1] == 0) {
return i;
}
int l = i, r = min(i + 100, n);
while (r - l > 1) {
int m = (l + r) / 2;
if (ASK(m) == ASK(l))
l = m;
else {
if (ASK(m)[0] + ASK(m)[1] == 0)
return m;
r = m;
}
}
i = r;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
5208 KB |
Output is correct |
2 |
Correct |
51 ms |
5464 KB |
Output is correct |
3 |
Correct |
24 ms |
5292 KB |
Output is correct |
4 |
Incorrect |
46 ms |
5624 KB |
Incorrect |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
4952 KB |
Output is correct |
2 |
Partially correct |
45 ms |
5252 KB |
Partially correct - number of queries: 9736 |
3 |
Partially correct |
32 ms |
5208 KB |
Partially correct - number of queries: 8008 |
4 |
Incorrect |
50 ms |
5364 KB |
Incorrect |
5 |
Halted |
0 ms |
0 KB |
- |