Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. n = int(input())
  2. stars = []
  3.  
  4. for _ in range(n):
  5. star_list = [int(i) for i in input().split()]
  6. stars.append({'start': star_list[0], 'end': star_list[1], 'desirability': star_list[2]})
  7.  
  8. # list of lists of stars
  9. all_overlapping = []
  10.  
  11. for star in stars:
  12. star_overlapping = []
  13. for other_star_index in range(len(stars)):
  14. other_star = stars[other_star_index]
  15. if star == other_star:
  16. continue
  17. if (star['start'] >= other_star['start'] and star['start'] <= other_star['end'] or
  18. star['end'] >= other_star['start'] and star['end'] <= other_star['end']):
  19. star_overlapping.append(other_star_index)
  20. all_overlapping.append(star_overlapping)
  21.  
  22.  
  23. def get_max_desirability(args):
  24. max_arg_desirability = -1
  25. max_arg_index = 0
  26. for index in args:
  27. if
  28.  
  29. max_desirabilities = []
  30. for i in range(len(all_overlapping)):
  31. max_desirabilities.append(get_max_desirability(all_overlapping[i]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement