-
[백준 문제풀이] 얼렁뚱땅 2075번 N번째 큰 수 풀이얼렁뚱땅 백준 문제풀이 2022. 4. 8. 21:22
이 문제를 푼 이유는 딴 것 없다
우선순위 큐를 내가 몰라서 그거때문에 가장 쉬운 우선순위 큐 문제를 풀이보고 다시 푼건데
미쳤다 queue랑 헷갈린다 q.popleft() q.append()
heapq.heappush(heap,num) heapq.heappop(heap) ..
import heapq import sys n = int(sys.stdin.readline()) heap = [] for i in range(n) : temp = list(map(int,sys.stdin.readline().split())) if not heap : for j in temp : heapq.heappush(heap, j) else : for j in temp : if j > heap[0] : heapq.heappush(heap,j) heapq.heappop(heap) print(heap[0])
'얼렁뚱땅 백준 문제풀이' 카테고리의 다른 글
[백준 문제풀이] 얼렁뚱땅 5671번 호텔 방 번호 풀이 (0) 2022.04.13 [백준 문제풀이] 얼렁뚱땅 1715번 카드 정렬하기 (0) 2022.04.08 [백준 문제풀이] 얼렁뚱땅 13706번 제곱근 풀이 (0) 2022.04.08 [백준 문제풀이] 얼렁뚱땅 14248번 점프 점프 풀이 (0) 2022.04.08 [백준 문제풀이] 얼렁뚱땅 16173번 점프왕 쩰리(Small) 풀이 (0) 2022.04.08