[Py]백준2075 - N번째 큰수 (힙정렬)

Imomo·2021년 4월 23일
0

코테 - 파이썬

목록 보기
4/9

문제링크

import sys 
import heapq 
input = sys.stdin.readline
n = int(input().rstrip())
q = [] 
for _ in range(n): 
	row = list(map(int, input().rstrip().split(" "))) 
	for r in row: 
		heapq.heappush(q, r) 
    while(len(q) > n):
    	heapq.heappop(q) 
print(heapq.heappop(q)) 

0개의 댓글