View difference between Paste ID: 6bsx3nXf and qYy9zRPL
SHOW: | | - or go back to the newest paste.
1
def solve(inp):
2
	h = MinHeap(key=lambda x: x[0])
3
	result = [None] * len(inp)
4
	for index, x in enumerate(inp):
5-
		while len(h) > 0 and h.min <= x / 2:
5+
		while len(h) > 0 and h.min()[0] <= x / 2:
6
			y = h.remove_min()
7
			result[y[1]] = index
8
		h.add((x, index))
9
	return result