[20251108] BOJ / P5 / 바리스타의 힘 / 한종욱 #1348
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/24439
🧭 풀이 시간
90분 + 90분
👀 체감 난이도
✏️ 문제 설명
일반적인 문제인데 바라본 방향을 보고 벽을 뚫는다. 최단거리는?
🔍 풀이 방법
벽을 뚫을 때, 해당 방향으로 도착할 수 있는 곳을 모두 queue에 넣는다. 그리고 다익스트라 느낌으로 최단거리를 체크해야 한다. 중복이 될 수도 있거든.
문제는 벽을 뚫을 때, 모든 도착할 수 있는 곳을 queue에 넣는 게 잘못됐다.
BFS에서 진행될 행동을 잘게 자른다.
으로 행동을 나눈 다음, 벽을 부술 땐 모두 부술 필요 없이 더 가까워질 때만 queue에 넣는다.
⏳ 회고
배운 건 세 가지다.