[20251215] BOJ / G2 / 벽 부수고 이동하기 4 / 김민진#1679
Merged
ShinHeeEul merged 2 commits intomainfrom Dec 15, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🧷 문제 링크
벽 부수고 이동하기 4
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
벽이 있는 셀의 벽을 부술 때 그 위치에서 접근할 수 있는 셀의 갯수를 계산해서 맵으로 출력하기
벽이 없었다면 0으로 출력
🔍 풀이 방법
벽이 아닌 부분들을 그룹핑해서 벽인 부분의 사방만 확인해도 도달 가능한 범위를 구할 수 있도록 함
1은 벽이라 2부터 부여함
벽 주변에 같은 그룹이 중복되어 인접할 수 있기 때문에 set으로 거름
⏳ 회고
2보다 쉬웠음
bfs 돌리면서 벽을 따로 저장하는 방법도 있네
bfs 한 번 돌 때마다 해당 그룹과 인접하는 모든 벽에 그룹 크기만큼 더해주기.. 좋은데?