{"problem":{"name":"Problem on Tree","description":{"content":"There is a tree with $N$ vertices, numbered $1$ through $N$. The $i$\\-th of the $N-1$ edges connects the vertices $p_i$ and $q_i$. Among the sequences of distinct vertices $v_1, v_2, ..., v_M$ that sa","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"relay_k"},"statements":[{"statement_type":"Markdown","content":"There is a tree with $N$ vertices, numbered $1$ through $N$.\nThe $i$\\-th of the $N-1$ edges connects the vertices $p_i$ and $q_i$.\nAmong the sequences of distinct vertices $v_1, v_2, ..., v_M$ that satisfy the following condition, find the maximum value of $M$.\n\n*   For every $1 \\leq i < M$, the path connecting the vertices $v_i$ and $v_{i+1}$ do not contain any vertex in $v$, except for $v_i$ and $v_{i+1}$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 10^5$\n*   $1 \\leq p_i, q_i \\leq N$\n*   The given graph is a tree.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$p_1$ $q_1$\n$p_2$ $q_2$\n:\n$p_{N-1}$ $q_{N-1}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"relay_k","tags":[],"sample_group":[["4\n1 2\n2 3\n2 4","3"],["10\n7 9\n1 2\n6 4\n8 1\n3 7\n6 5\n2 10\n9 6\n2 6","8"]],"created_at":"2026-03-03 11:01:13"}}