BOJ1927 최소힙

randi65535·2020년 12월 6일
0
import heapq
import sys
input = sys.stdin.readline

N = int(input())

hq = []
for i in range(N):
	n = int(input())

	if n == 0:
		if not hq:
			print(0)
		else:
			print(heapq.heappop(hq))
	else:
		heapq.heappush(hq, n)
profile
unsinged int 8byte-1

0개의 댓글