SHARE
TWEET

Untitled

a guest Oct 14th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Test string: 1 3 5 1 1 1 5 3 3 4 2
  2. inp = list(map(int, input().split(" ")))
  3.  
  4. # Separate circle data from rect data
  5. rect = inp[:8]
  6. cir = inp[8:]
  7.  
  8. # Debug coords #1
  9. # print(rect)
  10.  
  11. # Detach coordinates and delete duplicates
  12. xs = sorted(list(dict.fromkeys(rect[::2])))
  13. ys = sorted(list(dict.fromkeys(rect[1::2])))
  14.  
  15. # Debug coords #2
  16. # print(xs, ys)
  17. del rect
  18.  
  19. if xs[0] <= cir[0] <= xs[1] and ys[0] <= cir[1] <= ys[1]:
  20.     # print("Center is inside of rect")
  21.     if min(
  22.         [
  23.             abs(xs[0] - cir[0]),
  24.             abs(xs[1] - cir[0]),
  25.             abs(ys[0] - cir[1]),
  26.             abs(ys[1] - cir[1])
  27.         ]
  28.     ) >= cir[2]:
  29.         print("Circle is fully inside of rect")
  30.         quit()
  31.  
  32. print("Circle is not inside of rect")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top