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/1715
🧭 풀이 시간
35분
👀 체감 난이도
✏️ 문제 설명
숫자 카드 묶음이 N개 주어지고,
카드 두 묶음을 합치려면, 각 묶음의 카드 수를 더한 만큼의 비교 작업이 필요
이걸 반복해서 모든 카드 묶음을 하나로 만들되, 비교 횟수의 총합이 최소가 되게 만드는 게 목표
🔍 풀이 방법
작은 묶음부터 합쳐야 비교 횟수가 작아진다는 것을 인지
모든 카드 묶음을 우선순위 큐에 넣음
큐에서 2개를 꺼내 합치고, 그 값을 누적 비교 횟수에 더하기
큐에 1개만 남을 때까지 반복
⏳ 회고
그리디+우선순위 문제