백준 1927. 최소 힙
·
백준
https://www.acmicpc.net/problem/1927import heapq, sysinput = sys.stdin.readlinen = int(input())heap = []for _ in range(n): x = int(input()) if x == 0: print(heapq.heappop(heap)) if heap else print(0) else: heapq.heappush(heap, x)