#include using namespace std; int main() { int N; cin >> N; cout << "? " << 1 << endl; int S; cin >> S; cout << "? " << N-1 << endl; int s; cin >> s; S = S-(1-S)*2; s = s-(N-1-s)*2; if(S == s) { cout << "! " << 2 << " " << N-1 << endl; return 0; } int l = 1,r = N; while (l+1 < r) { int mid = (l+r)/2; cout << "? " << mid << endl; int a; cin >> a; a = a-(mid-a)*2; if(a == 0) { if(a >= N/2) { cout << "! " << 1 << " " << mid << endl; } else { cout << "! " << mid+1 << " " << N << endl; } return 0; } if(S < 0 && a < 0) { l = mid; continue; } if(S > 0 && a > 0) { l = mid; continue; } r = mid; } assert(0); }