import heapq
Β
ν μλ£κ΅¬μ‘° μνλ‘ λ§λ€μ΄μ€λ€
Β
import heapq // μ΄κΈ°ν heap = [] heapq.heapify(heap) // μλ£ μΆκ°μ μλ μ€λ¦μ°¨μμΌλ‘ μ λ ¬κ΅¬μ‘°λ₯Ό κ°λλ€ heap.heappush(heap,22) // [77] heap.heappush(heap,77) // [22,77] heap.heappush(heap,33) // [22,33,77] //μ κ±° ν λ¦¬ν΄ heap.heappop(heap) //22 heap //[33,77]