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 int long long
using namespace std;
bool pyta(int x,int y)
{
cout<<"? "<<x<<" "<<y<<"\n";
int co;
cin>>co;
return co;
}
int32_t main()
{
//cin.tie(0);
//cout.tie(0);
//ios_base::sync_with_stdio(0);
int n;
cin>>n;
int nie=3;
for(int i=1;i<=n;i++)
{
while(i-nie/2>=1 && i+nie/2<=n && pyta(i-nie/2,i+nie/2))
nie+=2;
}
int parz=2;
for(int i=1;i<=n;i++)
{
while(i-parz/2>=1 && i+parz/2-1<=n && pyta(i-parz/2,i+parz/2-1))
parz+=2;
}
cout<<"! "<<max(nie-2,parz-2);
return 0;
}
# | 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... |