[Miller] BOJ(11049): 행렬 곱셈 순서 - 문제풀이 추가#175
Open
rxdcxdrnine wants to merge 1 commit intoCodeSquad-Algorithm:mainfrom
Open
[Miller] BOJ(11049): 행렬 곱셈 순서 - 문제풀이 추가#175rxdcxdrnine wants to merge 1 commit intoCodeSquad-Algorithm:mainfrom
rxdcxdrnine wants to merge 1 commit intoCodeSquad-Algorithm:mainfrom
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.
너무 늦게 제출해서 죄송합니다 ㅠㅠ
문제를 푼 건 목요일 쯤이었는데.. 이제야 올립니다.
문제 풀이 방법
최근에 골드 3~4 문제를 주로 풀면서 DP 문제를 자주 마주쳤는데, 이번 문제 역시 DP 였습니다.
일단 이 문제를 풀이하는 것은 실패했습니다.
주어진 테스트 케이스를 몇 개 넣어봤을 때 통과했는데, 풀이를 제출하면 결국 틀리더라구요.
문제가 되는 테스트 케이스는 아래와 같았습니다.
예를 들면, ABCDE 를 곱한다고 했을 때
제 풀이는 A * BCDE 와 ABCD * E 중 행렬 곱셈의 최솟값을 구하지만,
정답 풀이는 A * BCDE, AB * CDE, ABC * DE, ABCD * E 중 행렬 곱셈의 최솟값을 구합니다.
정답의 풀이와 DP 배열 내 상태 공간 정의나 DP 내 반복 등이 거의 비슷했지만,
점화식에서 놓쳐 아쉬운 문제였습니다.
일단 테스트 케이스를 맞추는 것을 목표로 하기보다, 더 일반적인 해법을 생각해보면서 풀이해야겠습니다.