#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using namespace atcoder; int solve() { ll N; cin >> N; if (N % 2 == 1){ for(int i = 0;i+1 < N;i+= 2){ cout << "? " << i << " " << i+1 << endl; ll ret; cin >> ret; if (ret == i || ret == i+1){ cout << "? " << i << " " << N-1 << endl; ll ret2; cin >> ret2; if (ret2 == N-1){ cout << "! "<< i << endl; }else{ cout << "! " << i+1 << endl; } return 0; } } cout << "! " << N-1 << endl; }else{ for(int i = 0;i+2< N;i+= 2){ cout << "? " << i << " " << i+1 << endl; ll ret; cin >> ret; if (ret == i || ret == i+1){ cout << "? " << i << " " << N-1 << endl; ll ret2; cin >> ret2; if (ret2 == N-1){ cout << "! "<< i << endl; }else{ cout << "! "<< i+1 << endl; } return 0; } } cout << "? " << 0 << " " << N-1 << endl; ll ret3; cin >> ret3; if (ret3 == 0){ cout << "! " << N-1 << endl; }else{ cout << "! " << N-2 << endl; } } return 0; } int main() { // ll T; // cin >> T; // while (T--) // { solve(); // } cout << flush; return 0; }