[20260127] BOJ / G4 / RGB거리 2 / 강신지 #1846
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/17404
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
집들이 일렬로 N개 있고, 각 집은 RGB 중 하나의 색으로 칠해야 한다.
1번 집과 N번 집도 서로 이웃이므로 같은 색이면 안 된다.
인접한 집도 같은 색이면 안 된다.
각 집을 RGB로 칠하는 비용이 주어질 때 전체 비용의 최솟값을 구하면 된다.
🔍 풀이 방법
기존 RGB거리 문제와 다른 건 1번 집과 N번 집 색이 서로 달라야 한다는 것.
그니까 1번 집의 색을 고정하고 계산을 3번 반복해서 최소를 뽑아야 한다.
⏳ 회고