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;
#define ll long long
ll N, X, L, R, mid, tot = 0, tmp = 1, S;
int main () {
cin >> N;
L = 1;
R = N;
tmp = 1;
while(L < R) {
mid = (L+R)/2;
tot += mid*tmp;
tmp *= -1;
X = max(X, 1-tot);
L = mid+1;
}
cout << "? " << X << endl;
cin >> S;
L = 1;
R = N;
tmp = 1;
while(L < R) {
mid = (L+R)/2;
X += mid*tmp;
tmp *= -1;
cout << "? " << X << endl;
cin >> S;
if (S==1) R = mid;
else L = mid+1;
}
cout << "= " << L << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |