Skip to content

Commit 36a076b

Browse files
committed
[BOJ] #11279. 최대 힙 / 실버2 / 10분 / 성공
1 parent 7945b8a commit 36a076b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import sys
2+
import heapq
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
heap = []
7+
8+
while n > 0:
9+
num = int(input())
10+
n -= 1
11+
if num == 0:
12+
if len(heap) == 0:
13+
print(0)
14+
continue
15+
print(-heapq.heappop(heap))
16+
else:
17+
heapq.heappush(heap, -num)

0 commit comments

Comments
 (0)