[20250825] BOJ / G3 / 보물 찾기 2 / 이강현 #738
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/27978
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
2차원 배열에서 특정 지점에서 시작해서 도착지로 최소 비용으로 가는거.
이때 가중치가 0또는 1
🔍 풀이 방법
0-1 BFS
다익스트라처럼 구현하나 가중치가 0 또는 1이므로 우선 순위 큐를 사용하지 않고
덱을 사용하여 0일때는 앞에 1일때는 뒤에 넣으므로써 O(ElogV)가 아니라 O(E+V)로 구할 수 있음.
⏳ 회고
다익스트라랑 그리 다를게 없어서 어렵진 않았던 것 같다.