2 3 1 2 3 4 5 6 3 2 2 U 7 R 8 L 9
456
666
822
* Initially, Takahashi is at $(2,2)$.
* Move up, then set $A_{1,2}$ to $7$. The value of $f(P)$ for each path is:
* $P=((1,1),(1,2),(1,3),(2,3))$: $f(P)=1 \times 7 \times 3 \times 6=126$.
* $P=((1,1),(1,2),(2,2),(2,3))$: $f(P)=1 \times 7 \times 5 \times 6=210$.
* $P=((1,1),(2,1),(2,2),(2,3))$: $f(P)=1 \times 4 \times 5 \times 6=120$.
* Move right, then set $A_{1,3}$ to $8$. The value of $f(P)$ for each path is:
* $P=((1,1),(1,2),(1,3),(2,3))$: $f(P)=1 \times 7 \times 8 \times 6=336$.
* $P=((1,1),(1,2),(2,2),(2,3))$: $f(P)=1 \times 7 \times 5 \times 6=210$.
* $P=((1,1),(2,1),(2,2),(2,3))$: $f(P)=1 \times 4 \times 5 \times 6=120$.
* Move left, then set $A_{1,2}$ to $9$. The value of $f(P)$ for each path is:
* $P=((1,1),(1,2),(1,3),(2,3))$: $f(P)=1 \times 9 \times 8 \times 6=432$.
* $P=((1,1),(1,2),(2,2),(2,3))$: $f(P)=1 \times 9 \times 5 \times 6=270$.
* $P=((1,1),(2,1),(2,2),(2,3))$: $f(P)=1 \times 4 \times 5 \times 6=120$.5 4 147015809 294958521 852121867 499798308 790350368 404692331 645419803 290531806 275766153 896286651 239187926 945049742 340760022 236352314 926236110 223464913 287023679 590772036 340282357 521075891 6 3 1 U 344644511 R 45812235 D 260083498 R 781118585 L 156297846 L 411901560
299123226 548055393 810247224 876210800 773990840 506814544
{
"problem": {
"name": "Basic Grid Problem with Updates",
"description": {
"content": "There is an $H \\times W$ grid. Let $(h,w)$ denote the cell at the $h$\\-th row from the top and the $w$\\-th column from the left. A non-negative integer $A_{h,w}$ is written in cell $(h,w)$. Takahashi ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 5000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc190_c"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is an $H \\times W$ grid. Let $(h,w)$ denote the cell at the $h$\\-th row from the top and the $w$\\-th column from the left. A non-negative integer $A_{h,w}$ is written in cell $(h,w)$.\nTakahashi ...",
"is_translate": false,
"language": "English"
}
]
}