#include "bits/stdc++.h"
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long l;
void output(int num){
cout << "? " << num << endl;
return;
}
void input(bool &ok){
int num;
cin >> num;
ok = bool(num);
return;
}
int main()
{
int n, num; cin >> n;
int high=n, low=1, llast=INT_MIN;
cout << "? 0" << endl;
cin >> num;
while(low<=high){
int mid = (high+low+1)>>1;
output(mid);
bool ok; input(ok);
if(high==low&&!ok) {cout << "= " << llast << endl; return 0;}
else if(high==low&&ok){cout << "= " << mid << endl; return 0;}
if(ok) high = mid-1;
else low = mid+1;
if(ok) llast = mid;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |