Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/11000
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
강의실에서는 한개의 수업만 가능하다.
수업의 시작과 끝나는 시간이 주어졌을때, 최소한의 강의실로 모든 수업을 끝내도록 한다.
이때 강의실의 수를 출력
🔍 풀이 방법
우선순위 큐, 정렬
시작시간 기준 정렬을 하고 우선 순위큐에 강의들의 종료시간을 넣어둔다.
우선순위큐의 peek와 다음 수업의 시작시간을 비교했을때, 아직 peek가 더 작다면 종료되고 수업을 시작한다는 의미이므로 큐에서 제거한다.(강의실 재사용)
매 순간 pq의 사이즈를 체크하여 큐의 사이즈가 가장 클때의 값이 동시에 수업을 진행하기 위한 최소 강의실의 수이다.
⏳ 회고
회의실 배정 문제인줄알고 일단 종료시간으로 정렬해놓고 생각하다 오래걸렸다.
뭔가 묘하게 달라서 좀 어려웠다.