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 "prize.h"
#include<bits/stdc++.h>
using namespace std;
int ans = -1;
void calc(int l, int r) {
if(l > r) {
return;
}
int m = (l+r)/2;
vector<int> haha = ask(m);
if(haha[0]+haha[1] == 0) {
ans = m;
return;
}
if(l == r) {
return;
}
if(haha[0] > 0 && ans == -1) {
calc(l,m-1);
}
if(haha[1] > 0 && ans == -1) {
calc(m+1,r);
}
}
int find_best(int n) {
calc(0,n-1);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |