목차

스크루지 민호

ps
링크acmicpc.net/…
출처BOJ
문제 번호12896
문제명스크루지 민호
레벨골드 2
분류

트리의 지름

시간복잡도O(n)
인풋사이즈n<=100,000
사용한 언어Python 3.13
제출기록56252KB / 312ms
최고기록216ms
해결날짜2025/10/31

풀이

코드

"""Solution code for "BOJ 12896. 스크루지 민호".

- Problem link: https://www.acmicpc.net/problem/12896
- Solution link: http://www.teferi.net/ps/problems/boj/12896

Tags: [tree diameter]
"""

from teflib import tree as ttree


def main():
    _, tree = ttree.create_tree_from_input()
    print(ttree.DistanceMeasures(tree).radius)


if __name__ == '__main__':
    main()