[20251023] BOJ / G1 / 수영장 만들기 / 김수연 #1204
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/1113
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
땅 모양이 주어질 때, 수영장에 물이 얼마만큼 있을 수 있는지 구하기
🔍 풀이 방법
bfs 이용
땅의 최저와 최고 높이를 저장해두고, 해당하는 높이들을 돌면서 최저 -> 최대로 높이를 전반적으로 1씩 높이는 방법 사용함
⏳ 회고
처음에는 bfs 구현할 때, visited라는 2차원 배열을 만들었었는데, 메모리 초과가 계속 떠서 배열을 생성 안하고, land 자체에서 방문여부 및 물이 채워질 수 있는 여부를 판단해야 됐음
N이랑 M이 50보다 작거나 같아서 메모리 초과가 뜰 줄은 몰랐다.
쩝............