{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e给定一个有 $$$n$$$ 个顶点的无权树。回想一下,树是一个没有环的连通无向图。\u003c/p\u003e\u003cp\u003e你的任务是在这棵树上选择 \u003cspan class\u003d\"tex-font-style-bf\"\u003e三个不同的\u003c/span\u003e 顶点 $$$a, b, c$$$,使得在 $$$a$$$ 和 $$$b$$$、$$$b$$$ 和 $$$c$$$、或 $$$a$$$ 和 $$$c$$$ 之间的简单路径中至少有一条路径上的边的数量是最大可能的。更多细节请参见注释部分。\u003c/p\u003e\u003cp\u003e简单路径是指每个顶点最多访问一次的路径。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数 $$$n$$$ ($$$3 \\le n \\le 2 \\cdot 10^5$$$) — 树中顶点的数量。\u003c/p\u003e\u003cp\u003e接下来的 $$$n - 1$$$ 行描述树的边,格式为 $$$a_i, b_i$$$ ($$$1 \\le a_i$$$, $$$b_i \\le n$$$, $$$a_i \\ne b_i$$$)。保证给定的图是一棵树。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e第一行输出一个整数 $$$res$$$ — 在 $$$a$$$ 和 $$$b$$$、$$$b$$$ 和 $$$c$$$、或 $$$a$$$ 和 $$$c$$$ 之间的简单路径中至少有一条路径上的边的最大数量。\u003c/p\u003e\u003cp\u003e第二行输出三个整数 $$$a, b, c$$$,使得 $$$1 \\le a, b, c \\le n$$$ 和 $$$a \\ne, b \\ne c, a \\ne c$$$。\u003c/p\u003e\u003cp\u003e如果有多个答案,你可以输出任意一个。\u003c/p\u003e"}},{"title":"示例 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e8\n1 2\n2 3\n3 4\n4 5\n4 6\n3 7\n3 8\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\n1 8 6\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注释","value":{"format":"HTML","content":"\u003cp\u003e第一个示例对应的图片(以及\u003cspan class\u003d\"tex-font-style-bf\"\u003e另一个正确答案\u003c/span\u003e):\u003c/p\u003e\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/6d4c715d950959ff03d1ed9e401c24b2?v\u003d1711027147\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\u003cp\u003e如果你选择顶点 $$$1, 5, 6$$$,那么 $$$1$$$ 和 $$$5$$$ 之间的路径包括边 $$$(1, 2), (2, 3), (3, 4), (4, 5)$$$,$$$1$$$ 和 $$$6$$$ 之间的路径包括边 $$$(1, 2), (2, 3), (3, 4), (4, 6)$$$,$$$5$$$ 和 $$$6$$$ 之间的路径包括边 $$$(4, 5), (4, 6)$$$。这些路径的并集是 $$$(1, 2), (2, 3), (3, 4), (4, 5), (4, 6)$$$,因此答案是 $$$5$$$。可以证明没有更好的答案。\u003c/p\u003e"}}]}