[20250727] BOJ / G5 / 가희와 프로세스 1 / 이강현 #555
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/21773
🧭 풀이 시간
15분
👀 체감 난이도
✏️ 문제 설명
프로세스들을 스케쥴러가 고르는 문제
각 프로세스들은 id, 남은 시간, 우선순위를 가짐.
스케쥴러는 프로세스를 우선순위가 높은 것부터, 같다면 id가 낮은 것부터 1초 실행하고 시간이 남았다면 다시 고려대상으로 둠.
이때 T초동안 선택된 프로세스의 id를 출력
🔍 풀이 방법
우선순위 큐
comparator만 설정하면 풀리는 ez 문제
실행한 프로세스를 제외한 나머지 우선순위를 1씩 올린다고 어그로 끄는거를 실행한 프로세스의 우선순위를 1 낮추는 걸로 해결함.
⏳ 회고
ez