fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string in;
  6. int t, x, y, wx, wy;
  7. pair<int, int>poz;
  8. pair<int, int>pion;
  9.  
  10. void podw()
  11. {
  12. if(in[0]=='N')
  13. {
  14. pion.first=wy;
  15. }
  16. else
  17. {
  18. pion.second=wy;
  19. }
  20. if(in[1]=='W')
  21. {
  22. poz.second=wx;
  23. }
  24. else
  25. {
  26. poz.first=wx;
  27. }
  28. }
  29.  
  30. void poj ()
  31. {
  32. if(in[0]=='N')
  33. {
  34. pion.first=wy;
  35. }
  36. else if (in[0]=='S')
  37. {
  38. pion.second=wy;
  39. }
  40. else if(in[0]=='W')
  41. {
  42. poz.second=wx;
  43. }
  44. else
  45. {
  46. poz.first=wx;
  47. }
  48. }
  49.  
  50. int main()
  51. {
  52. ios_base::sync_with_stdio(0);
  53. cin>>t;
  54. while(--t+1)
  55. {
  56. cin>>x>>y;
  57. poz=make_pair(1, x);
  58. pion=make_pair(1, y);
  59. wx=(poz.second+1)/2;
  60. wy=(pion.second+1)/2;
  61. cout<<wx<<" "<<wy<<endl;
  62. cin>>in;
  63. if(in=="OK")
  64. continue;
  65.  
  66. while(in!="OK")
  67. {
  68. if(in.length()==2)
  69. podw();
  70. else
  71. poj();
  72.  
  73. wx=poz.second-((poz.second-poz.first+1)/2);
  74. wy=pion.second-((pion.second-pion.first+1)/2);
  75. cout<<wx<<" "<<wy<<endl;
  76.  
  77. cin>>in;
  78. }
  79. }
  80. return 0;
  81. }
  82.  
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
Standard output is empty