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;
typedef long long ll;
int main() {
int n; cin>>n;
int ans=-1;
for (int i=n; i>1; i--) {
for (int j=1; j+i-1<=n; j++) {
if (j+i-1>n) continue;
cout<<"? "<<j<<" "<<j+i-1<<endl;
int res; cin>>res;
if (res==1) {
ans=i;
break;
}
}
if (ans!=-1) break;
}
if (ans==-1) ans=1;
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... |