[20251029] PGM / LV2 / 전력망을 둘로 나누기 / 강신지#1262
Merged
ShinHeeEul merged 1 commit intomainfrom Oct 29, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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://school.programmers.co.kr/learn/courses/30/lessons/86971
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
n개의 송전탑이 트리 형태로 연결되어 있다. 전선을 하나 끊어 두 전력망으로 나뉘었을 때, 두 송전탑 개수의 차이가 최소가 되도록 하는 값을 구하라.
🔍 풀이 방법
모든 전선을 하나씩 끊어보며, 끊은 상태에서 BFS로 한쪽 네트워크의 송전탑 개수를 센다.
다른 쪽은 전체에서 그 개수를 빼서 구하고, 두 개수의 차이를 계산한다.
이 과정을 반복해 최소 차이를 갱신한다.
⏳ 회고
그냥 하면 된다