반응형
# @Author YoungMinKim
# baekjoon
import heapq
import sys
N = int(sys.stdin.readline())
heap = []
for _ in range(N):
num = int(sys.stdin.readline())
if num == 0:
if len(heap) == 0:
print(0)
else:
print(heapq.heappop(heap))
else:heapq.heappush(heap,num)
반응형
'백준 문제풀이' 카테고리의 다른 글
baekjoon - python - 10815 (0) | 2020.10.10 |
---|---|
baekjoon - python - 10867 (0) | 2020.10.10 |
baekjoon - python - 11279 (0) | 2020.10.04 |
baekjoon - python - 1002 (0) | 2020.10.04 |
baekjoon - python - 2869 (0) | 2020.10.03 |
댓글