[20250818] BOJ / G4 / 치즈 / 김수연 #685
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/2636
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
사각형 모양의 판의 크기와 한 조각의 치즈가 주어질 때,
공기 중에서 치즈가 모두 녹아 없어지는 데 걸리는 시간과 모두 녹기 한 시간 전에 남아있는 치즈조각이 놓여 있는 칸의 개수 구하기
🔍 풀이 방법
bfs 사용
공기와 맞닿아있는 치즈의 부분을 구하고, 해당 부분만큼 0으로 바꾸고, 바뀐 것의 갯수를 셈
⏳ 회고
처음에는 모든 치즈의 면에 대해서 했는데, 시간이 오래걸려서
0,0부터 공기에 맞닿아 있는 부분을 초기화하고 시작하는 방법을 사용해서 걸리는 시간을 줄였다.