[20251124] BOJ / P3 / 달리기 #1497
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/16930
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
BFS에서 한 칸씩 이동하는 게 아니라 K칸씩 이동할 수 있을 때, 최단 시간은?
🔍 풀이 방법
BFS이지만 한 칸을 최대 4번 도달할 수 있어서, 그 부분을 체크해야 함
그것만 하면 기본 BFS와 같음
⏳ 회고
BFS는 가중치가 같을 때, 다익스트라보다 빠르다.$O(V+E)$ $O((V+E)logV)$
BFS의 시간복잡도:
다익스트라의 시간복잡도:
그리고 count를 4로 했어야 했는데, 그냥 직감(찍었다고 해야하나)으로 4방향이면 왔다 갔다가 있을 수 있어서 2로 제한했는데도 맞았다.
실제 코테에선 4로 풀어야겠다.
근데 2로 해도되나? @oncsr