# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743627 | rahidilbayramli | Guess the number (BOI20_guess) | C++17 | 2547 ms | 208 KiB |
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>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pb push_back
#define all(v) v.begin(), v.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
using namespace std;
int main()
{
ll n;
cin >> n;
ll l = 1, r = n, ans = -1, mid;
while(l <= r)
{
mid = (l + r) / 2;
cout << "? " << mid << "\n";
cout << flush;
string s;
cin >> s;
if(s == "-1")
l = mid;
if(s == "0")
{
cout << "= " << mid << "\n";
cout << flush;
return 0;
}
else
r = mid;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |