2 2
20
For example, Takahashi could behave as follows.
* Moves to vertex $1$ and paints it. This action is chosen with probability $\frac{1}{2}$.
* Moves to vertex $0$. This action is chosen with probability $\frac{1}{2}$.
* Moves to vertex $1$. This action is chosen with probability $\frac{1}{2}$.
* Moves to vertex $3$ and paints it. This action is chosen with probability $\frac{1}{2}$.
* Moves to vertex $1$. This action is chosen with probability $1$.
* Moves to vertex $0$. This action is chosen with probability $\frac{1}{2}$.
* Moves to vertex $2$ and paints it. This action is chosen with probability $\frac{1}{2}$.
* Moves to vertex $4$ and paints it. This action is chosen with probability $\frac{1}{2}$.
He behaves in this way with probability $\frac{1}{128}$, in which case the number of operations is $8$. The expected number of operations is $20$.123456 185185
69292914
{
"problem": {
"name": "Random Walk on Tree",
"description": {
"content": "There is a tree with $N \\times M + 1$ vertices numbered $0, 1, \\dots, N \\times M$. The $i$\\-th edge $(1 \\leq i \\leq N \\times M)$ connects vertices $i$ and $\\max(i - N, 0)$. Vertex $0$ is painted. Th",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc185_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a tree with $N \\times M + 1$ vertices numbered $0, 1, \\dots, N \\times M$. The $i$\\-th edge $(1 \\leq i \\leq N \\times M)$ connects vertices $i$ and $\\max(i - N, 0)$. \nVertex $0$ is painted. Th...",
"is_translate": false,
"language": "English"
}
]
}