fork download
  1. #include <bits/stdc++.h>
  2.  
  3. #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  4. #define ll long long
  5. #define mod 1000000007
  6. using namespace std;
  7.  
  8. string s;
  9.  
  10. void solve(int x,int y,int r){
  11. if (x>y)swap(x,y);
  12.  
  13. printf("? %d %d",x,y);
  14. fflush(stdout);
  15. cin>>s;
  16. if (s!="x" and s!="y"){
  17. exit(0);
  18. }
  19.  
  20. if (s=="x" and y-x==1){
  21. printf("! %d",y);
  22. fflush(stdout);
  23. return;
  24. }
  25.  
  26. if (s=="x"){
  27. r=1;
  28. solve(x,x+1,r);
  29. }
  30. else{
  31. r*=2;
  32. solve(y,y+r,r);
  33. }
  34. }
  35.  
  36. int main(){
  37.  
  38. string s;
  39. while(true){
  40. cin>>s;
  41. if (s!="start")return 0;
  42.  
  43. printf("? 1 10");
  44. fflush(stdout);
  45. cin>>s;
  46. if (s!="x" and s!="y")return 0;
  47. if (s=="x"){
  48. printf("! 1");
  49. fflush(stdout);
  50. continue;
  51. }
  52.  
  53. solve(1,2,1);
  54. }
  55. return 0;
  56. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty