[20250210] BOJ / 플래5 / Class Schedule / 권혁준#68
Merged
ShinHeeEul merged 1 commit intomainfrom Feb 10, 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/4142
🧭 풀이 시간
16분
👀 체감 난이도
✏️ 문제 설명
집에서 출발해서 모든 과목을 종류별로 하나씩 듣고 도서관으로 가는 최소 에너지를 구해보자.
🔍 풀이 방법
dp[i][j] = i번째 과목의 j번째 수업을 들었을 때 최소 에너지로 정의하면 수월하다.
$dp[i][j] = \min(dp[i-1][k] + E[i][j] + \abs(P[i][j] - P[i-1][k]))$
⏳ 회고
NoSuchElementException이라는 걸 처음 봤다.
존재하지 않는 것을 가져오려할 때 발생한다고 한다.
입력 받는 부분을 잘못 처리하고 있었는데, 하필 예제에서만 입력 개수가 동일하고, 답도 똑같이 나와서 뭐가 문제인지 모르고 있었다.