3 3 3 2 2 2 1 3 1 5 4
3 There are six possible paths: * $(1, 1) \rightarrow (1, 2) \rightarrow (1, 3) \rightarrow (2, 3) \rightarrow (3, 3)$: the integers written on the squares he visits are $3, 2, 2, 3, 4$, so he **will not** be happy. * $(1, 1) \rightarrow (1, 2) \rightarrow (2, 2) \rightarrow (2, 3) \rightarrow (3, 3)$: the integers written on the squares he visits are $3, 2, 1, 3, 4$, so he **will not** be happy. * $(1, 1) \rightarrow (1, 2) \rightarrow (2, 2) \rightarrow (3, 2) \rightarrow (3, 3)$: the integers written on the squares he visits are $3, 2, 1, 5, 4$, so he **will** be happy. * $(1, 1) \rightarrow (2, 1) \rightarrow (2, 2) \rightarrow (2, 3) \rightarrow (3, 3)$: the integers written on the squares he visits are $3, 2, 1, 3, 4$, so he **will not** be happy. * $(1, 1) \rightarrow (2, 1) \rightarrow (2, 2) \rightarrow (3, 2) \rightarrow (3, 3)$: the integers written on the squares he visits are $3, 2, 1, 5, 4$, so he **will** be happy. * $(1, 1) \rightarrow (2, 1) \rightarrow (3, 1) \rightarrow (3, 2) \rightarrow (3, 3)$: the integers written on the squares he visits are $3, 2, 1, 5, 4$, so he **will** be happy. Thus, the third, fifth, and sixth paths described above make him happy.
10 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
48620 In this example, every possible path makes him happy.
{
"problem": {
"name": "Make Takahashi Happy",
"description": {
"content": "There is a grid with $H$ horizontal rows and $W$ vertical columns. For two integers $i$ and $j$ such that $1 \\leq i \\leq H$ and $1 \\leq j \\leq W$, the square at the $i$\\-th row from the top and $j$\\-t",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc293_c"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a grid with $H$ horizontal rows and $W$ vertical columns. For two integers $i$ and $j$ such that $1 \\leq i \\leq H$ and $1 \\leq j \\leq W$, the square at the $i$\\-th row from the top and $j$\\-t...",
"is_translate": false,
"language": "English"
}
]
}