#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+50;
int 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;
}
}
void solve(int l,int r){
if(l > r)return;
int md = (l+r)/2;
qu(md);
if(ans != -1)return;
solve(l,md-1);
solve(md+1,r);
}
int find_best(int N) {
memset(dp,0,sizeof(dp));
n = N;
ans = -1;
solve(0,n-1);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
87 ms |
1016 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
64 ms |
1144 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |