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://www.acmicpc.net/problem/30745
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
루트가 1인 트리가 있고, 각 점$i$ 는 $c[i]$ 라는 값을 가진다.
어떤 두 점$u, v$ 에 대해, 서로 조상-자식의 관계가 아니라면, 둘은 논쟁을 할 수 있다.$c[u] + c[v]$ 이다.
이 때 intensity값은
트리의 tension이란, 존재하는 argument의 intensity의 합이다.
각 점$i$ 는 다음 조건을 만족할 때 매니저라고 불린다.
모든 점이 매니저일 때, 가능한 tension의 최솟값을 구해보자.
🔍 풀이 방법
어떤 점$i$ 에 대해, $i$ 아래에 존재하는 점들을 한 번씩 논쟁시켜야 하는데, 서로 조상-자식의 관계면 논쟁할 수 없다.$i$ 의 자식들을 각각 루트로 하는 서브트리에서 하나씩 꺼내서 논쟁시키는 것이 이득이다.
-> 당연히
이 때, 자식들 서브트리의 크기를 큰 순서대로$cnt_1, cnt_2, \cdots, cnt_k$ 라고 할 때, $cnt_1$ 이 나머지 $cnt$ 의 합보다 작거나 같으면, 그냥 $i$ 서브트리의 합과 동일하거나, 개수가 홀수면 최솟값 한 번만 더해주면 된다.
⏳ 회고
영어 지문이라 문제를 이해하는 데만 20분이 걸렸다.