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 fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second
ll n, l, r, mid, x, c, memo;
bool b;
int main() {
fastio;
cin >> n;
l = 1;
r = n;
c = 1e9;
for (int i = 1; i <= 32; i++) {
mid = (l+r)/2;
cout << "? " << 1 << endl;
cin >> b;
cout << "? " << mid << endl;
cin >> b;
if (!b) {
l = mid + 1;
} else {
r = mid - 1;
c = min(c, mid);
}
}
cout << "= " << c << 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... |