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;
bool pors(int l,int r){
if(l>r||l<=0){
return 0;
}
if(l==r){
return 1;
}
cout<<"? "<<l<<" "<<r<<endl;
int x;
cin>>x;
return x;
}
int main(){
int res=1;
int n;
cin>>n;
for(int i=2;i<=n;i++){
if(pors(i-res,i)){
res++;
}else if(pors(i-res-1,i)){
res++;
}
}
cout<<"! "<<res<<"\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... |