[20251125] BOJ / G3 / 색상환 / 이강현 #1506
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/2482
🧭 풀이 시간
2일
👀 체감 난이도
✏️ 문제 설명
N개의 색깔 종류가 원형으로 주어짐.
이중 K개의 색상을 고를것임.
인접한 두 색깔을 고를 수 없음.
경우의 수 출력.
🔍 풀이 방법
원형 dp
dp[N][K]를 N개의 색깔중 K개를 고르는 경우의 수라고 정의.
이미 순서가 정해져있고 따라서 고르면 되는 문제이므로 순서는 중요치 않음.
선형 dp라고 생각하고 dp를 업데이트한 후,
마지막 색깔을 칠하는지, 칠하지 않는지로 나누어서 원형 dp 조건을 만족시키자.
⏳ 회고
어렵네