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;
const int nx=100;
int n, tmp, l, r, t, lst, x, dp[nx];
int query(int x)
{
cout<<"? "<<x<<endl;
cin>>tmp;
return tmp;
}
int main()
{
cin>>n;
l=1, r=n+1;
query(1);
for (int i=1; i<n; i++)
{
if (i%2) r--, dp[r-l]=query(r);
else l++, dp[r-l]=query(l);
//cout<<"dis "<<r-l<<' '<<dp[r-l]<<'\n';
}
for (int i=1; i<=n; i++) if (dp[i]) return cout<<"= "<<i, 0;
cout<<"= "<<n;
}
# | 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... |