Skip to content

Conversation

@Seol-JY
Copy link
Contributor

@Seol-JY Seol-JY commented Jun 16, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/1967

🧭 풀이 시간

35분

👀 체감 난이도

✏️ 문제 설명

가중치가 있는 트리에서 트리 지름 구하기

🔍 풀이 방법

임의의 노드에서 가장 먼 노드는 반드시 지름의 끝점 중 하나 라는 원리를 이용해서
dfs 두번 돌려서 최장 거리 찾기

⏳ 회고

처음에는 리프노드 간 최장 거리가 트리의 지름이라 오해했는데, 이는 가중치가 있는 트리에서는 의미가 없다
트리 지름을 구하는 알고리즘을 알고있어야 쉽게 풀 수 있는 문제였는듯

@Seol-JY Seol-JY added the hint 💡 반례를 참고했거나 힌트를 얻고 풀었을 때 label Jun 16, 2025
@ShinHeeEul ShinHeeEul merged commit 3650a2d into main Jun 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hint 💡 반례를 참고했거나 힌트를 얻고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants