Baekjoon #1927

Baekjoon #1927

1개의 풀이 · Python

문제 원문 보기 ↗

SOLUTION INFO

Python · main.py

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

풀이 설명

등록된 풀이 설명이 없습니다.