This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define endl '\n'
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
const int N = 3e5+1;
const ll INF = 2e18;
const int MOD = 1e9+7;
vector<int> ask(int i);
int find_best(int n) {
int l = 0,r = n-1;
int ans = -1;
while(l<=r){
int mid = (l+r)/2;
vector<int> arr = ask(mid);
assert(arr[0]+arr[1] <= 1);
if(arr[0] == 1)
r = mid-1;
else if(arr[1] == 1)
l = mid+1;
else{
ans = mid;
break;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |