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://school.programmers.co.kr/learn/courses/30/lessons/42627
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
우선순위 디스크 컨트롤러가 있을 때,
대기 큐가 비어있지 않으면 가장 우선순위가 높은 작업을 대기 큐에서 꺼내서 작업함
작업의 소요시간이 짧은 것, 작업의 요청 시각이 빠른 것, 작업의 번호가 작은 것 순으로 우선순위가 높음
디스크 컨트롤러가 작업을 처리했을 때 모든 요청 작업의 반환 시간의 평균의 정수부분 구하기
🔍 풀이 방법
PriorityQueue 사용
걸리는 시간, 시작 시간 순으로 정렬을 하고, pq에서 하나씩 꺼내면서 각 작업의 완료되는 시간을 더해줌
이후에 작업의 총 갯수로 나눠서 평균 구함
⏳ 회고
조금의 생각이 필요한 문제였다.