SOLUTION INFO
Python · main.py
import sys
import heapq
def input():
return sys.stdin.readline().rstrip()
N = int(input())
heap = []
for i in range(N):
x = int(input())
if x == 0:
if not heap:
print(0)
else:
print(heapq.heappop(heap))
else:
heapq.heappush(heap,x)
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.