[20251126] BOJ / G5 / 내려가기 / 강신지 #1515
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/2096
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
N줄에 0 이상 9 이하의 숫자가 세 개씩 적혀 있다.

한 줄에 하나씩 수를 선택하며 그 숫자가 점수에 더해진다.
선택할 때는 사진처럼 바로 아래, 혹은 그 인근의 수만 선택 가능.
마지막 줄까지 도달했을 때 얻을 수 있는 최대/최소 점수를 구하라.
🔍 풀이 방법
dp로 풀었다.
max와 min을 모두 구하기 위해 3 크기의 배열을 두 개 두었음.
초기화 해두고 n-1까지 반복하며 최대/최소 갱신.
⏳ 회고
처음에 메모리 초과가 나서 당황했는데,
아무생각 없이 풀다가 2차원 배열 map을 [n][n]으로 잡아뒀었다...