[20251120] BOJ / G5 / 농장관리 / 이준희 #1458
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/1245
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
높이가 주어진 격자모양의 지도가 있을 때
같은 높이를 가지는 하나 혹은 그 이상의 인접한 격자들의 집합을 산봉우리라고 합니다.
이 때 인접한 은 8방향 입니다.
또한 산봉우리 집합과 인접한 모든 곳의 높이는 산봉우리보다 낮아야 합니다.
이 때 지도 전체에서 봉우리의 갯수를 구하는 문제입니다.
🔍 풀이 방법
bfs를 이용해서 풀었습니다.
플래그를 두어 판단하였고 모든 점에 대해서 bfs를 수행했습니다.
인접한 곳을 순회하면서 높이가 같으면 넣고 그 주변이 높이가 낮은 부분을 찾았습니다.
⏳ 회고
그냥 무식하게 풀면 되는 문제였습니다.