[20250313] BOJ / P5 / 운전 면허 시험 / 권혁준 #241
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/10251
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
M행 N열 격자 그리드 모양의 운전 면허 시험장에 세 가지 시험 규칙이 존재한다.
최단 시간을 구해보자.
🔍 풀이 방법
[사용한 알고리즘]
오른쪽, 아래로만 이동할 수 있기 때문에, 걸리는 시간은 무조건
(L * (N+M-2)) + (방향 전환 횟수)이다.dp[x][y][n]를 (x,y)까지 방향 전환 n회로 도달하는 경우 중 연료 소모량의 최솟값으로 정의해서, dp[N][M][n] <= G인 n의 최솟값을 찾아주면 문제를 해결할 수 있다.
⏳ 회고
다익스트라로 풀었다가 시간 초과 맞고, 굳이 다익스트라가 필요없다는 걸 깨달았다.