[20251117] BOJ / G4 / 서울에서 경산까지 / 이강현 #1436
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/14863
🧭 풀이 시간
120분
👀 체감 난이도
✏️ 문제 설명
서울에서 경산까지 N개의 구간을 자전거 혹은 도보를 통해 갈거임.
가면서 구간마다 모금을 할거임. 이때 이동수단에 따라 모금액이 다름.
K분 이내로 가는데 가장 많은 모금액을 얻도록 할때, 그 모금액을 출력.
🔍 풀이 방법
배낭
배낭문제처럼 풀되, 갈 수 없는 경우의 dp값이 전파되는 것을 꼭 막는 것이 핵심.
⏳ 회고
어차피 K안에 갈 수 있으니 간단하게 풀었는데, 유효하지 않은 dp값을 업데이트시 사용하지 않도록 하는 것이 중요했다.