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;
signed main () {
int n;
cin >> n;
cout << "? 2" << endl;
int x;
cin >> x;
int r = n + 1;
for(int l = 2, f = 1;; f = 1 - f) {
if(f) {
r -= 2;
cout << "? " << r << endl;
cin >> x;
if(x == 0) {
cout << "? " << r - (r - l + 1) << endl;
cin >> x;
if(x == 1) {
cout << "= " << (r - l + 1) << endl;
}else {
cout << "= " << (r - l + 1) + 1 << endl;
}
return 0;
}
}else {
l += 2;
cout << "? " << l << endl;
cin >> x;
if(x == 0) {
cout << "? " << l + (r - l + 1) << endl;
cin >> x;
if(x == 1) {
cout << "= " << (r - l + 1) << endl;
}else {
cout << "= " << (r - l + 1) + 1 << endl;
}
return 0;
}
}
}
return 0;
}
# | 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... |