[20250905] BOJ / G3 / 사회망 서비스(SNS) / 김민진 #823
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.
🧷 문제 링크
사회망 서비스(SNS)
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
얼리어답터인 경우 depth 1의 자식에게 영향을 미칠 수 있음.
모든 노드가 영향을 받을 수 있는 최소한의 얼리어답터 수는?
🔍 풀이 방법
DP..
dp[ node ][ 0(일반인) / 1(얼리어답터) ]내가 얼리어답터가 아닐 때 자식 중 최소 한 명은 얼리어답터여야 하니까 초기화를 1로 진행함.
dp[cur][0] = 1내가 얼리어답터면 자식이 얼리어답터일 필요가 없으니까
dp[child][0]값을 더해주고얼리어답터가 아니면 자식이 얼리어답터든 아니든 상관없어서 자식이 일반인일 때와 얼리어답터일 때를 비교해서 더 작은 값을 더해줌.
⏳ 회고
어려운 거 + 어려운 거