#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN=2e5+5;
const ll INF=1e9+7;
int find_best(int n) {
ll i;
ll lo=0,hi=n-1,mid;
while(hi-lo>=2){
mid = lo+(hi-lo)/2;
vector<int> res = ask(mid);
if(res[0]+res[1]==0)return mid;
if(res[0]==1){
hi=mid;
}else{
lo=mid;
}
}
//cout<<lo<<" "<<hi<<endl;
for(i=lo;i<=hi;i++){
vector<int> res = ask(i);//cout<<i<<" "<<res[0]<<" "<<res[1]<<endl;
if(res[0]+res[1]==0)return i;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
280 KB |
Output is correct |
3 |
Correct |
1 ms |
280 KB |
Output is correct |
4 |
Correct |
1 ms |
284 KB |
Output is correct |
5 |
Correct |
1 ms |
284 KB |
Output is correct |
6 |
Correct |
1 ms |
280 KB |
Output is correct |
7 |
Correct |
1 ms |
284 KB |
Output is correct |
8 |
Correct |
1 ms |
280 KB |
Output is correct |
9 |
Correct |
0 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
280 KB |
Output is correct |
2 |
Correct |
1 ms |
288 KB |
Output is correct |
3 |
Correct |
1 ms |
284 KB |
Output is correct |
4 |
Correct |
1 ms |
284 KB |
Output is correct |
5 |
Correct |
1 ms |
284 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
0 ms |
276 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Incorrect |
1 ms |
200 KB |
answer is not correct |
12 |
Halted |
0 ms |
0 KB |
- |