- 우선순위 큐를 이용한 최소 회의실 개수(겹치는 것 불가)를 구하는 문제다.
백준 - 1374번 강의실
백준 - 11000번 강의실 배정
백준 - 1931번 회의실 배정
백준 - 19621번 회의실 배정2
백준 - 19622번 회의실 배정3
백준 - 19623번 회의실 배정4
백준 - 19598번 최소 회의실 개수
백준 - 16220번 회의
import heapq
import sys
input = sys.stdin.readline
heap = []
timetable = []
N = int(input())
for _ in range(N):
num, S, T = map(int, input().strip().split())
timetable.append([S, T])
timetable.sort(key=lambda x : x[0]) # 시작 시간을 기준으로 오름차순 정렬
heapq.heappush(heap, timetable[0][1])
for i in range(1, N):
if heap[0] > timetable[i][0]:
heapq.heappush(heap, timetable[i][1])
else:
heapq.heappop(heap)
heapq.heappush(heap, timetable[i][1])
print(len(heap))