#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;cin>>n;
int l=1,r=n;
vector<int> v;
while(r-l>1){
int m=(l+r)>>1;
v.push_back(m);
l=m;
}
bool flag=0;
int s=n;
int n1=v.size();
for(int i=n1-1;i>=0;i--){
if(flag==0){
s-=v[i];
}
else{
s+=v[i];
}
flag^=1;
}
cout<<"? "<<s<<endl;
int b=0;
cin>>b;
l=0,r=n;
while(r-l>1){
int m=(l+r)>>1;
if(flag==1){
s+=m;
}
else{
s-=m;
}
flag^=1;
cout<<"? "<<s<<endl;
int k;cin>>k;
if(k==1){
r=m;
}
else{
l=m;
}
}
cout<<"= "<<r<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |