#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> ans[210000];
int mx = -1;
int find_best(int n) {
for(int i = 0; i < 500; i++){
ans[i] = ask(i);
if(ans[i][0] + ans[i][1] == 0){
return i;
}
mx = max(mx, ans[i][0] + ans[i][1]);
}
int id = 0;
while(id < n){
while(ans[id][0] + ans[id][1] != mx){
id++;
ans[id] = ask(id);
if(ans[id][0] + ans[id][1] == 0) return id;
}
int l = id, r = n - 1;
int k = 0;
while(l <= r)
{
int m = (l + r) >> 1;
ans[m] = ask(m);
if(ans[m][1] != ans[id][1] || ans[m][0] + ans[m][1] < mx) r = m - 1;
else {
l = m + 1;
k = m;
}
}
id = k + 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
5240 KB |
answer is not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
5300 KB |
answer is not correct |
2 |
Halted |
0 ms |
0 KB |
- |