#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 |
1 |
Incorrect |
70 ms |
344 KB |
L = 25, expected 30 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
344 KB |
L = 25, expected 30 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1247 ms |
344 KB |
L = 33, expected 52 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
344 KB |
L = 25, expected 30 |
2 |
Halted |
0 ms |
0 KB |
- |