fork download
  1. // Board Meeting problem. for N=1
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main(){
  7. int T=1, N=1, M=1e6, R=1000;
  8. int x1,x2, y1,y2, d1,d2,a,x,y;
  9. string s;
  10. cin>> T >> N >> M >> R;
  11. for(int i=1;i<=T; i++){
  12. cout<< -1000000 << " " << -1000000 << endl <<flush;
  13. cin>>s; //distance 1
  14. for(auto &x:s) x= toupper(x);
  15. if(s=="ERROR") return 0;
  16. else d1= stoi(s);
  17. cout<< 1000000 << " " << 1000000 << endl <<flush;
  18. cin>>s; //distance 2
  19. for(auto &x:s) x= toupper(x);
  20. if(s=="ERROR")return 0;
  21. else d2= stoi(s);
  22. x1= -1000000 + d1;
  23. y1= 1000000 - d2;
  24. x2= 1000000 - d2;
  25. y2= -1000000 + d1;
  26. cout<< x1 << " " << y1 << endl <<flush;
  27. cin >> a;
  28. if(a==0){x=x1; y=y1;}
  29. else{ x=x2; y=y2;}
  30. cout<<"READY\n" <<flush;
  31. while(R--){
  32. cin>>s;
  33. for(auto &x:s) x= toupper(x);
  34. if(s=="DONE") break;
  35. if(s=="ERROR") return 0;
  36. x1= stoi(s);
  37. cin>>y1;
  38. x2 = abs(x-x1);
  39. y2 = abs(y-y1);
  40. if(x2>y2) cout<< x2 << endl << flush;
  41. else cout<< y2 << endl << flush;
  42. }
  43. }
  44. return 0;
  45. }
Runtime error #stdin #stdout #stderr 0s 4528KB
stdin
Standard input is empty
stdout
-1000000 -1000000
stderr
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi