3 7 2 2 2 1 1 2 2 3 3 7 0 2 4 1 1 2 2 3 3 7 2 0 4 1 1 2 2 4 4
Yes Yes No For the first test case, if you, for instance, write `XXYXYXX` in this order on vertices $1$ to $7$, * from the edge $(1, 2)$, we obtain `XX`, * from the edge $(1, 3)$, we obtain `XY`, * from the edge $(2, 4)$, we obtain `XX`, * from the edge $(2, 5)$, we obtain `XY`, * from the edge $(3, 6)$, we obtain `YX`, and * from the edge $(3, 7)$, we obtain `YX`. Each of `XX`, `XY`, and `YX` occurs twice, so the condition is satisfied. For the second case, one way to satisfy the condition is to write `XYYXXXX`. For the third case, there is no way to satisfy the condition.
{
"problem": {
"name": "XXYX Binary Tree",
"description": {
"content": "You are given a rooted tree with $N$ vertices. The vertices are numbered $1$ to $N$, and the root is vertex $1$. The parent of each vertex $i$ except the root is vertex $P_i$. Each vertex, including t",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 3000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc157_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a rooted tree with $N$ vertices. The vertices are numbered $1$ to $N$, and the root is vertex $1$. The parent of each vertex $i$ except the root is vertex $P_i$. Each vertex, including t...",
"is_translate": false,
"language": "English"
}
]
}