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/14908
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
구두 수선을 하는데 i번째 작업을 완료하는 데$T_i$ 일이 걸린다. i번째 작업을 시작하기 전에 하루가 지연될 때마다 구두 수선공은 보상금 $S_i$ 센트를 지불해야 한다. 구두 수선공이 최저 보상금을 지불하는 작업 순서를 정해라. (여러 답이 나올 경우 오름차순 정렬에 의해 가장 첫 해답 출력)
🔍 풀이 방법
문제에서 중요한 것은 "시간 대비 벌금이 센 것"을 우선해서 처리해야 한다. 따라서,${S_i}/{T_i}$ 를 우선순위 큐에 정렬한 다음, 동일한 값이 있을 땐, index를 기준으로 오름차순한다. 그 다음 순서대로
poll하면서 출력한다.⏳ 회고
그리디 문제라는 걸 알고 풀어서 쉬웠다.