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;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define all(x) x.begin(), x.end()
//#define endl '\n'
const int N=200005;
int ask(int a,int b){
cout<<"? "<<a<<' '<<b<<endl;
int p;cin>>p;
return p;
}
int32_t main() {
LCBorz;
int n;cin>>n;
int ans=0;
for(int t:{0,1}){
int len=t;
for(int i=1;i<=n;i++){
while(i+len+1<=n&&ask(i,i+len+1)){
len+=2;
i--;
}
ans=max(ans,len);
}
}
cout<<"! "<<ans<<endl;
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... |