고급 탐색

#우선순위 큐

백준 1927번 : 최소 힙

- 자료 구조, 우선순위 큐

1. 풀이

import heapq

n = int(input())
heap = []
result = []
for _ in range(n):
  data = int(input())
  if data == 0:
    if heap:
      result.append(heapq.heappop(heap))
    else:
      result.append(0)

  else:
    heapq.heappush(heap, data)

for data in result:
  print(data)

백준 1715번 : 카드 정렬하기

- 자료 구조, 그리디 알고리즘, 우선순위 큐

1. 풀이


백준 1766번 : 문제집

- 그래프 이론, 자료 구조, 우선순위 큐, 위상 정렬!!

1. 풀이

Last updated