Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Building Visibility by kazuki.h
def checkio(buildings):
result = set()
for i in range(12):
i += 0.5
result_i = set()
buildings_i = sorted([(x1, y1, h) for x1, y1, x2, y2, h in buildings if x1 <= i <= x2], key = lambda x: x[1])
max_hight = 0
for build_i in buildings_i:
if build_i[2] > max_hight:
max_hight = build_i[2]
result_i.add(build_i[:2])
result = result|result_i
return len(result)
Dec. 7, 2021