이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a, b, c, d, e, n, m, l, r, mid, ind, pos;
bool barla(int k)
{
bool ret;
cout<<"? "<<k<<endl;
cin>>ret;
return ret;
}
int main()
{
cin>>n;
l=1; r=n;
pos=-1; ind=pos;
int bir=1;
while (l<r)
{
mid=(l+r-1)/2;
ind=ind+(bir*mid);
pos=min(pos, ind);
l=mid+1;
bir=bir*(-1);
}
pos=abs(pos);
barla(pos);
l=1; r=n; bir=1;
bool hakyky=false;
while (l<r)
{
mid=(l+r-1)/2;
pos=pos+(bir*mid);
hakyky=barla(pos);
if (hakyky) r=mid;
else l=mid+1;
bir=bir*(-1);
}
cout<<"= "<<l<<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... |