[20251127] BOJ / G5 / 강의실 / 설진영 #1527
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/1374
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
N개의 강의가 주어지고,
각 강의의 시작/종료 시간이 주어진다. 모든 강의를 진행하기 위해 필요한 최소 강의실 개수를 구하는 문제.
🔍 풀이 방법
그리디 + 우선순위 큐
강의를 시작 시간 기준 오름차순 정렬, 우선순위 큐에 현재 사용 중인 강의실들의 종료 시간을 저장
최종 크기가 필요한 최소 강의실 수
시작 시간 순으로 처리하면서, 재사용 가능한 강의실 중 가장 빨리 끝나는 것을 그리디하게 선택
⏳ 회고
전형적인 회의실 문제