3 1 2 2 3
5 For example, the sequence $(a_1, a_2, a_3) = (2, 1, 3)$ can be obtained by the following steps: * Choose the first edge, swap the pieces on vertices $1$ and $2$, and delete the edge. This results in $(a_1, a_2, a_3) = (2, 1, 3)$. * Finish operating. Also, the sequence $(a_1, a_2, a_3) = (3, 1, 2)$ can be obtained by the following steps: * Choose the second edge, swap the pieces on vertices $2$ and $3$, and delete the edge. This results in $(a_1, a_2, a_3) = (1, 3, 2)$. * Choose the first edge, swap the pieces on vertices $1$ and $2$, and delete the edge. This results in $(a_1, a_2, a_3) = (3, 1, 2)$. * Finish operating. The operation can yield the following five sequences: * $(1, 2, 3)$ * $(1, 3, 2)$ * $(2, 1, 3)$ * $(2, 3, 1)$ * $(3, 1, 2)$
5 2 5 3 4 1 3 1 5
34
8 4 5 2 5 3 6 1 3 1 8 2 7 2 8
799
{
"problem": {
"name": "Swap on Tree",
"description": {
"content": "There is a tree with $N$ vertices numbered $1$ to $N$. The $i$\\-th edge connects vertices $u_i$ and $v_i$. Additionally, there are $N$ pieces numbered $1$ to $N$. Initially, piece $i$ is placed on v",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc171_c"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a tree with $N$ vertices numbered $1$ to $N$. The $i$\\-th edge connects vertices $u_i$ and $v_i$. \nAdditionally, there are $N$ pieces numbered $1$ to $N$. Initially, piece $i$ is placed on v...",
"is_translate": false,
"language": "English"
}
]
}