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/11985
🧭 풀이 시간
120분
👀 체감 난이도
✏️ 문제 설명
오렌지를 M개 이하로 묶어서 넣을 수 있는데 이 때, 최소 비용은?
🔍 풀이 방법
dp 상태 정의: i번째 오렌지를 넣었을 때 최소 비용
$dp[i]$ 는 $dp[i]$ 와 $dp[j-1]+cost$ 로 비교해야 한다. j는 i부터 i-M+1까지 탐색하면서 이전 상태에 다음 상자를 만든다는 개념으로 가야 한다.
⏳ 회고
일단 최대값 설정을 잘못해서 틀렸고, i-M+1까지 비교해야 했는데 계속 i-M까지 비교했다.