목차

Time To Live

ps
링크acmicpc.net/…
출처BOJ
문제 번호3973
문제명Time To Live
레벨골드 2
분류

트리의 지름

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

풀이

코드

"""Solution code for "BOJ 3973. Time To Live".

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

Tags: [tree diameter]
"""

from teflib import psutils
from teflib import tree as ttree


@psutils.run_n_times
def main():
    _, tree = ttree.create_tree_from_input(base=0)
    print(ttree.DistanceMeasures(tree).radius)


if __name__ == '__main__':
    main()