Advertisement
WupEly

Untitled

Dec 23rd, 2022
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. ax1, ay1, ax2, ay2 = list(map(int, input().split()))
  2. ax2 = ax1 + ax2
  3. ay2 = ay1 + ay2
  4.  
  5. bx1, by1, bx2, by2 = list(map(int, input().split()))
  6. bx2 = bx1 + bx2
  7. by2 = by1 + by2
  8.  
  9. s1 = (ax1 >= bx1 and ax1 <= bx2) or (ax2 >= bx1 and ax2 <= bx2)
  10. s2 = (ay1 >= by1 and ay1 <= by2) or (ay2 >= by1 and ay2 <= by2)
  11. s3 = (bx1 >= ax1 and bx1 <= ax2) or (bx2 >= ax1 and bx2 <= ax2)
  12. s4 = (by1 >= ay1 and by1 <= ay2) or (by2 >= ay1 and by2 <= ay2)
  13.  
  14. print("YES" if ((s1 and s2) or (s3 and s4)) or ((s1 and s4) or (s3 and s2)) else "NO")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement