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/21279
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
2차원 좌표평면의 1사분면과 그 경계의 영역에 N개의 광물이 있다.
i번째 광물을 캐는 비용은 1이고, 광물의 아름다운 정도는 V[i]이다.
원점 (0,0)에서 광산 뒤집기를 사용할 수 있다. 사용하면 (0,0)을 왼쪽 아래 꼭짓점으로 하는 H*W 영역의 광물을 모두 캔다.
광물을 C개 이하 캐면서 얻을 수 있는 아름다움의 합을 최대화해보자.
🔍 풀이 방법
x좌표 기준으로 광물을 정렬시키고, 어떤 x좌표에 있는 광물들을 모두
우선순위 큐에 넣는다.이때 광물의 수가 C이하가 되도록 y좌표가 큰 순서대로 우선순위 큐에서 빼낸다.
이 과정을 반복하면서 아름다움의 합 중 최댓값을 구해줬다.
⏳ 회고
지문에 스킬을 한 번만 써야된다는 얘기가 없어서 이해하는데 한참 걸렸다