[20250904] BOJ / P5 / Two Machines / 한종욱#816
Merged
ShinHeeEul merged 1 commit intomainfrom Sep 4, 2025
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/17528
🧭 풀이 시간
120분
👀 체감 난이도
✏️ 문제 설명
job에 시간이 있고, a, b에서 걸리는 시간이 다르다. 두 머신을 적절히 사용해서 최소로 모든 job을 처리해라.
🔍 풀이 방법
dp[i][j] = i번째 작업까지 처리했을 때, 기계 A가 j시간 사용된 경우의 기계 B의 최소 사용 시간으로 정의했다.job을 a에 넣는 경우와 b에 넣는 경우로 나눠서
dp[i][j + task[0][i-1]] = Math.min(dp[i][j + task[0][i-1]], dp[i-1][j]);dp[i][j] = Math.min(dp[i][j], dp[i-1][j] + task[1][i-1]);로 점화식을 세워 풀 수 있다.
⏳ 회고
일단 index도 값으로 처리하는 방식이 새로웠다. 그리고 2차원이 아니라 1차원도 가능한 문제이기 때문에 주말에 1차원으로 다시 풀어봐야 한다.