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 <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int left = 1, right = N;
while (left < right) {
int tmp = (right + left) / 2;
cout << "? " << tmp << endl;
int ans;
cin >> ans;
if (ans == 1) {
right = tmp-1;
} else if (ans == 0) {
cout << "= " << tmp << endl; return 0;
} else {
left = tmp+1;
}
}
cout<< "= " << left << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |