[20251224] BOJ / G3 / 가장높은탑쌓기 / 한종욱 #1734
Merged
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/2655
🧭 풀이 시간
100분
👀 체감 난이도
✏️ 문제 설명
벽돌마다 밑면, 무게, 높이가 주어지는데, 벽돌을 쌓을 때 제일 높게 쌓는 경우의 벽돌 사용 개수와 각 인덱스를 순서대로 출력하라.
🔍 풀이 방법
일단 밑면의 넓이를 기준으로 내림차순으로 정렬했다.
그렇게 순차적으로 탐색해야 밑면은 무시할 수 있기 때문이다.
dp[i]= i번째 벽돌을 가장 위에 쌓았을 때의 최대 높이 로 상태정의하고i번째보다 작은 벽돌들을 순차적으로 탐색하면서 무게 조건을 확인해 dp[i]보다 큰 것이 있으면 그것으로 갱신한다.
⏳ 회고
LIS 어려워~. 비슷한 문제를 계속 풀어봐야겠어.