백준 1927번 - 최소 힙 [Python]
문제 링크 : https://www.acmicpc.net/problem/1927풀이 과정파이썬의 heapq 라이브러리를 이용해 풀이했다.전체 코드# 1927 : 최소 힙import sysimport heapqinput = sys.stdin.readlinen = int(input().rstrip())pq = []for _ in range(n): v = int(input().rstrip()) if v == 0: print(heapq.heappop(pq) if pq else 0) else: heapq.heappush(pq, v)
Problem Solving/BOJ
2025. 10. 16. 11:17
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Sort
- Python
- C++
- knapsack
- Binary-Search
- queue
- Prefix-Sum
- lca
- implementation
- Greedy
- backtracking
- DP
- sparse_table
- java
- ad_hoc
- bruteforcing
- PS
- bitmask
- BFS
- codeup
- string
- number_theory
- lazy-propagation
- C
- BOJ
- segment-tree
- stack
- kmp
- 백준
- math
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함
