쏘ing
[Python] 백준 11279 최대 힙 본문
https://www.acmicpc.net/problem/11279
풀이
import heapq
import sys
num = int(sys.stdin.readline().rstrip())
num_list = []
for _ in range(num):
temp = int(sys.stdin.readline().rstrip())
# 최대 힙
heapq.heappush(num_list, (-temp, temp))
if temp == 0:
print(heapq.heappop(num_list)[1])
'알고리즘 > CLASS 3' 카테고리의 다른 글
[Python] 백준 11047 동전 0 (0) | 2022.02.21 |
---|---|
[Python] 백준 11399 ATM (0) | 2022.02.21 |
[Python] 백준 1764 듣보잡 (0) | 2022.02.21 |
[Python] 백준 17219 비밀번호 찾기 (0) | 2022.02.21 |
[Python] 백준 1620 나는야 포켓몬 마스터 이다솜 (0) | 2022.02.21 |
Comments