Advertisement
WupEly

Untitled

Dec 23rd, 2022
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. line1 = list(map(int, input().split()))
  2. line2 = list(map(int, input().split()))
  3.  
  4. square1 = {
  5. "a": (line1[0], line1[1]),
  6. "b": (line1[0] + line1[2], line1[1]),
  7. "c": (line1[0], line1[1] - line1[3]),
  8. "d": (line1[0] + line1[2], line1[1] - line1[3])
  9. }
  10.  
  11. square2 = {
  12. "a": (line2[0], line2[1]),
  13. "b": (line2[0] + line2[2], line2[1]),
  14. "c": (line2[0], line2[1] - line2[3]),
  15. "d": (line2[0] + line2[2], line2[1] - line2[3])
  16. }
  17.  
  18. maxx1 = square1["b"][0]
  19. minx1 = square1["a"][0]
  20. maxy1 = square1["a"][1]
  21. miny1 = square1["c"][1]
  22.  
  23. maxx2 = square2["b"][0]
  24. minx2 = square2["a"][0]
  25. maxy2 = square2["a"][1]
  26. miny2 = square2["c"][1]
  27.  
  28. if maxx1 > maxx2 or maxy1 > maxy2:
  29. for x, y in square2.values():
  30. print(minx1, x, maxx1, miny1, y, maxy1)
  31. if minx1 <= x <= maxx1 or miny1 <= y <= maxy1:
  32. print("YES")
  33. break
  34. else:
  35. print("NO")
  36. else:
  37. for x, y in square1.values():
  38. print(minx2, x, maxx2, miny2, y, maxy2)
  39. if minx2 <= x <= maxx2 or miny2 <= y <= maxy2:
  40. print("YES")
  41. break
  42. else:
  43. print("NO")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement