#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+50;
int l,r,dp[maxn],ans,n;
void qu(int a){
if(dp[a])return;
dp[a] = 1;
vector<int> res = ask(a);
if(res[0] + res[1] == 0){
ans = a;
}
if(res[0] > res[1]){
l = 0;
r = a - 1;
}else{
l = a + 1;
r = n - 1;
}
}
int find_best(int N) {
srand(time(0));
n = N;
l=0;r=n-1;
ans = -1;
while(1){
int a = l + (rand() % (r-l+1));
qu(a);
if(ans != -1)return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
95 ms |
1016 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
1152 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |