260108 : [BOJ 1113] 수영장 만들기 #2291
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.
🚀 이슈 번호
Resolve: {#2284}
🧩 문제 해결
스스로 해결: ❌
🔎 접근 과정
입력값 외부에 0으로 된 border를 채운다.
이후 board 전역에 비가 내린다고 가정하여 높이가 1부터 max까지 차오른다고 해보자.
이제 각 높이에 따라 0,0부터 bfs를 진행하면서
현재 높이보다 낮은 곳들을 방문해나간다.
(방문한 곳은 현재 높이로 채우기)
해당 방식으로 bfs를 진행하고 난 이후에
현재 높이보다 낮은
board값은 물이 차오르지 않은 영역 (벽으로 둘러쌓인 영역) 이므로수영장 내부를 의미하게 된다.
⏱️ 시간 복잡도
💻 구현 코드