#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; int main() { int l = 0, r = 1e9, res; cout << "? " << r << endl; cin >> res; if (res == 0) { cout << "! " << r - 1 << endl; return 0; } int hoge = 0; while (l < r - 4) { if (hoge) { cout << "? " << l << endl; cin >> res; if (res == 0) { if (l == 0) { cout << "! 0" << endl; return 0; } else { cout << "! " << l - 1 << endl; return 0; } } else if (res == -1) { l = max(0, l - 5); while (1) { if (l == 0) { cout << "! 0" << endl; return 0; } else { cout << "! " << l - 1 << endl; return 0; } } } } else { int m = (l + r) / 2; cout << "? " << m << endl; cin >> res; if (res == 1) { l = m; } else if (res == -1) { r = m; } else { if (m == 0) { cout << "! 0" << endl; return 0; } else { cout << "! " << m - 1 << endl; return 0; } } } hoge = 1 - hoge; } while (1) { cout << "? " << l << endl; cin >> res; if (res == 0) { if (l == 0) { cout << "! 0" << endl; return 0; } else { cout << "! " << l - 1 << endl; return 0; } } } }