#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;
void qu(int a){
if(dp[a])return;
dp[a] = 1;
vector<int> res = ask(a);
if(res[0] + res[1] == 1){
if(res[0])r = a-1;
else l = a+1;
}
if(res[0] + res[1] == 0){
ans = a;
}
}
int find_best(int n) {
srand(time(0));
l=0;r=n-1;
ans = -1;
while(1){
int a = l + (rand() % (r-l+1));
qu(a);
if(ans != -1)return ans;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
312 KB |
Output is correct |
2 |
Correct |
2 ms |
388 KB |
Output is correct |
3 |
Correct |
2 ms |
308 KB |
Output is correct |
4 |
Correct |
2 ms |
444 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
4 ms |
516 KB |
Output is correct |
9 |
Correct |
2 ms |
312 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
352 KB |
Output is correct |
2 |
Correct |
2 ms |
328 KB |
Output is correct |
3 |
Correct |
2 ms |
416 KB |
Output is correct |
4 |
Correct |
2 ms |
420 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
2 ms |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
248 KB |
Output is correct |
8 |
Correct |
2 ms |
248 KB |
Output is correct |
9 |
Correct |
2 ms |
248 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Incorrect |
86 ms |
1064 KB |
Incorrect |
12 |
Halted |
0 ms |
0 KB |
- |