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/14727
🧭 풀이 시간
25분
👀 체감 난이도
✏️ 문제 설명
히스토그램 모양의 퍼즐 조각이 N개 있고, 각 조각의 높이는 H[i]이다.
자를 수 있는 가장 큰 직사각형의 넓이를 구해보자.
🔍 풀이 방법
조각이 높은 것부터 반영하며, 분리 집합으로 양쪽의 활성화된 조각들과 연결한다.
(연결된 최대 컴포넌트 수 * 현재 높이) 중 최댓값을 저장해두고 출력하면 된다.
⏳ 회고
유명한 유형이다.
분할 정복, 세그먼트 트리, 스택 등 다양한 풀이가 있지만 분리 집합이 개인적으로 제일 쉽다고 생각한다.