fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int ask(int l, int r) {
  5. cout << "? " << l << ' ' << r << '\n';
  6. cout.flush();
  7.  
  8. int res;
  9. cin >> res;
  10. return res;
  11. }
  12.  
  13. void answer(int l, int r) {
  14. cout << "! " << l << ' ' << r << '\n';
  15. cout.flush();
  16. }
  17.  
  18. int main() {
  19. int T, phi;
  20. cin >> T >> phi;
  21.  
  22. int n, res;
  23.  
  24. cin >> n;
  25. res = ask(1, 3);
  26. res = ask(1, 1);
  27. res = ask(1, 2);
  28. answer(1, 3);
  29.  
  30. cin >> n;
  31. res = ask(1, 5);
  32. res = ask(1, 2);
  33. res = ask(1, 1);
  34. res = ask(1, 3);
  35. answer(2, 4);
  36.  
  37. return 0;
  38. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
? 1 3
? 1 1
? 1 2
! 1 3
? 1 5
? 1 2
? 1 1
? 1 3
! 2 4