Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Feb 3, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/2665

🧭 풀이 시간

20분

👀 체감 난이도

✏️ 문제 설명

$N \times N$ 2차원 격자가 주어지며, 각 칸은 흰 방(이동 가능) 혹은 검은 방(이동 불가능)입니다.
인접한 상하좌우로 이동이 가능하며, 1행 1열에서 $N$$N$열까지 이동하려 할 때 지나게 되는 검은 방의 최소 개수를 구하는 문제입니다.

🔍 풀이 방법

흰 방으로 갈 때는 가중치가 $0$이고, 검은 방으로 갈 때는 가중치가 $1$이 되는 0-1 BFS로 해결할 수 있습니다.

⏳ 회고

지금까지 0-1 BFS를 구현할 때 그냥 다익스트라를 쓰거나 Queue[] 형태를 사용했었는데, Deque 하나만을 이용한 방식을 알게되었습니다.

@ShinHeeEul ShinHeeEul merged commit 65a9ffa into main Feb 3, 2025
1 check passed
@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Feb 3, 2025
@oncsr oncsr self-assigned this Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants