[20250812] BOJ / G4 / 인구 이동 / 이준희 #650
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/16234
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
n*n의 맵이 있고 각 칸은 개별의 나라로 인구가 주어졌을 때
날마다 인접한 두 나라의 인구 차이가 l 이상 r 이하이면 국경이 열리고 각 인구 합의 평균으로 맞춰집니다.
이 때 더이상 국경이 열리지 않을 때 까지 걸리는 시간을 구하는 문제입니다.
🔍 풀이 방법
bfs를 수행하고 국경이 열리는 곳들을 list로 묶어서 유지한 후
매 수행 이후 그 list에 들어있는 곳을 평균으로 맞춰주는 식으로 풀었습니다.
⏳ 회고
각 분기마다 연합되는 나라들을 유지하는 방식을 빨리 떠올려서 빨리 풀 수 있었던 것 같습니다