This repository was archived by the owner on Mar 18, 2024. It is now read-only.
[2023-08-28] sumin #145#169
Merged
Merged
Conversation
Woo-Yeol
approved these changes
Aug 28, 2023
Member
There was a problem hiding this comment.
저도 다음의 아이디어에서 항상 어떻게 최대값을 가져오지 했는데 Heap이 있었네요! 안다고 생각했던 것들을 적절하게 사용하는 것도 체크가 필요할 것 같네요! 많은 걸 배워갑니다 ㅎㅎ
Closed
limstonestone
approved these changes
Aug 28, 2023
Contributor
limstonestone
left a comment
There was a problem hiding this comment.
힙을 공부해보겠습니다...ㅎ
풀이 감사합니다 수밍님~!
zsmalla
approved these changes
Aug 28, 2023
Contributor
There was a problem hiding this comment.
아이디어를 떠올리기까지 과정을 간략하게 적어주신 점이 좋은 것 같아요!
Contributor
There was a problem hiding this comment.
힙을 활용해서 효율적이고도 간결하게 문제를 풀이해내실 수 있었던 것 같습니다. 발생할 수 있는 예외 처리 과정도 완벽했던 것 같아요!
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PR Summary
풀이시간: 20분
<input>
<solution>
a^2 + b^2 + ... + x^2이 최소가 되려면 계속해서 가장 작업량이 큰 수를 먼저 처리해야 함
예를 들어, [7, 8] 작업이 있다고 생각했을 때 당연하게도 8을 7로 줄이는 것이 야근 피로도가 최소가 되고 [7, 7]일 때는 어떤 것을 줄이든 상관없음. [7, 6]이 됐을 때는 다시 7을 6으로 줄이는 것이 야근 피로도를 최소화할 수 있게 됨
-> 이를 통해 항상 전체 작업 중 작업량이 가장 큰 값을 먼저 처리해야 됨을 알 수 있음
-> works의 길이가 최대 20,000이기 때문에 n번 max함수를 쓰면 시간초과가 나기 때문에 우선순위큐를 사용해서 최대값을 찾을 수 있음
<시간복잡도>
O(n): 최대 퇴근까지 남은 시간 n번만 확인하면 됨