[20250915] BOJ / G3 / 그래프 리뷰 유튜버 / 권혁준 #900
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/34220
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
트리에 최소 개수의 간선을 추가해서 3색 이하의 컬러링이 불가능하도록 만들어보자.
🔍 풀이 방법
3색 이하의 컬러링이 불가능하려면, 간선을 추가했을 때 크기가 4인 완전 그래프가 부분 그래프로 존재해야 한다.
그래서 추가해야 하는 최소 간선의 개수는 3으로 고정이 된다.
차수가 3인 정점이 있다면, 그 정점과 연결된 세 점으로 완전 그래프가 구성되도록 간선을 추가했다.
차수가 2인 정점밖에 없다면, 길이 3인 아무 경로나 잡아서 그 네 개의 점으로 완전 그래프가 구성되도록 간선을 추가했다.
⏳ 회고
신기함