# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1192191 | prideliqueee | Guess the number (BOI20_guess) | C++20 | 0 ms | 412 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int n;
cin>>n;
int l=1,r=n;
while(l<r)
{
int mid=(l+r)/2;
cout<<"? "<<mid<<endl;
int x;
cin>>x;
if(x==0)
{
cout<<"= "<<mid;
return 0;
}
if(x==1)
{
r=mid-1;
}
else if(x==-1)
{
l=mid+1;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |