#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++){
while(pors(i-res,i)){
res++;
}
}
cout<<"! "<<res<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
344 KB |
L = 22, expected 30 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
344 KB |
L = 22, expected 30 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
514 ms |
344 KB |
L = 29, expected 52 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
344 KB |
L = 22, expected 30 |
2 |
Halted |
0 ms |
0 KB |
- |