4 1 2 3 4 2 3
4 1 2 3 The procedure in the sample output is as follows: * 1st operation: Remove vertices $4$ and $1$. The remaining tree has vertices $2$ and $3$, and a perfect matching. The score of this operation is $3$. * 2nd operation: Remove vertices $2$ and $3$. The remaining tree has zero vertices and a perfect matching. The score of this operation is $1$. * The total score is $3 + 1 = 4$. It is impossible to make the total score greater than $4$, so this output solves this sample input.
8 1 2 3 4 5 6 7 8 2 3 1 5 1 7
4 8 7 6 5 3 2 1
14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 8 4 11 5 12 7 13 11 14 9 13
1 6 5 2 8 12 3 7 10 4 11 9 13 14
20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 10 16 18 16 19 5 9 10 17 2 13 7 14 3 7 3 12
6 1 2 15 20 13 14 19 16 4 11 18 17 12 3 5 9 7 8 10
{
"problem": {
"name": "Keep Perfectly Matched",
"description": {
"content": "There is a tree with $N$ vertices numbered from $1$ to $N$. The $i$\\-th edge connects vertices $A_i$ and $B_i$. Here, $N$ is even, and furthermore, this tree has a perfect matching. Specifically, for ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc183_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a tree with $N$ vertices numbered from $1$ to $N$. The $i$\\-th edge connects vertices $A_i$ and $B_i$. Here, $N$ is even, and furthermore, this tree has a perfect matching. Specifically, for ...",
"is_translate": false,
"language": "English"
}
]
}