fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int bl_up_x, bl_up_y, bl_dw_x, bl_dw_y;
  6. int wh_up_x, wh_up_y, wh_dw_x, wh_dw_y;
  7. int p_x, p_y;
  8. cin >> bl_up_x >> bl_up_y >> bl_dw_x >> bl_dw_y;
  9. cin >> wh_up_x >> wh_up_y >> wh_dw_x >> wh_dw_y;
  10. cin >> p_x >> p_y;
  11. bool is_in_black = p_x <= bl_dw_x and p_x >= bl_up_x and p_y <= bl_up_y and p_y >= bl_dw_y;
  12. bool is_in_white = p_x < wh_dw_x and p_x > wh_up_x and p_y < wh_up_y and p_y > wh_dw_y;
  13. cout << (is_in_black and not is_in_white ? "HAPPY" : "SAD");
  14. }
Success #stdin #stdout 0s 4696KB
stdin
2 10 5 3 4 4 6 1 2 9
stdout
HAPPY