https://www.acmicpc.net/problem/1927
정답.
어제보다 더 쉬웠다!
heapq 사용해서 해결!
import sys
import heapq
n = int(sys.stdin.readline())
heap = []
for i in range(n) :
num = int(sys.stdin.readline())
if num == 0 :
if len(heap) == 0 :
print(0)
continue
else :
print(heapq.heappop(heap))
continue
heapq.heappush(heap,num)