[20250418] BOJ / P5 / 백조의 호수 / 이강현 #316
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/3197
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
빙판과 물로 이루어진 맵에서 물과 빙판이 만나면 빙판이 녹음. 빙판이 녹아서 백조가 서로 만날 수 있게 되는 최소 시간을 구하기
🔍 풀이 방법
BFS를 이용하여 빙판이 녹는 것과 백조를 만나러 움직이는 것을 반복
⏳ 회고
예제를 테스트하는 것은 금방했는데 시간 초과를 해결하는게 어려웠음.
백조를 만나러 가다가 막히는 곳을 큐에 저장하고 다음에 녹을 빙판을 큐에 저장하는 것을 구현해서
매번 전부 돌지 않고 물과 빙판의 경계에서 처리하여 최적화하는 것이 핵심.