{"problem":{"name":"A. Circumference of a Tree","description":{"content":"Hopefully you know how to find the diameter of a tree. That's the first part of tree basics, after all! But this problem is completely different: now, you need to find the *circumference* of a tree! ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269A"},"statements":[{"statement_type":"Markdown","content":"Hopefully you know how to find the diameter of a tree. That's the first part of tree basics, after all! But this problem is completely different: now, you need to find the *circumference* of a tree!\n\nAs you probably know, pi is equal to the ratio between something's circumferance and its diameter. Also, as you may not know, math is a lie and *pi is really equal to 3*. Rumor has it, this is where the number tree(3) comes from.\n\nAssuming pi equals 3, what is the circumference of the given tree?\n\nThe first line will contain a single integer $n$, the number of nodes in the tree. $n -1$ lines follow, each containing two different integers, describing the edges of the tree. Additional constraint on input: these edges will form a tree.\n\n$1 <= n <= 3 * 10^5$\n\nOutput a single integer: the circumference of the tree.\n\n## Input\n\nThe first line will contain a single integer $n$, the number of nodes in the tree. $n -1$ lines follow, each containing two different integers, describing the edges of the tree. Additional constraint on input: these edges will form a tree.$1 <= n <= 3 * 10^5$\n\n## Output\n\nOutput a single integer: the circumference of the tree.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T = (V, E) $ be a tree with $ n $ nodes and $ n-1 $ edges.  \nLet $ d(u, v) $ denote the shortest path distance (number of edges) between nodes $ u $ and $ v $ in $ T $.  \nLet $ \\text{diam}(T) = \\max_{u,v \\in V} d(u, v) $ be the diameter of the tree.\n\n**Constraints**  \n1. $ 1 \\le n \\le 3 \\times 10^5 $  \n2. The graph is a tree (connected, acyclic, undirected).\n\n**Objective**  \nGiven $ \\pi = 3 $, compute the circumference of the tree:  \n$$\n\\text{circumference} = \\pi \\cdot \\text{diam}(T) = 3 \\cdot \\text{diam}(T)\n$$  \nOutput this value as an integer.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269A","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}