{"problem":{"name":"Tatami","description":{"content":"We have a grid with $H$ horizontal rows and $W$ vertical columns. We denote by square $(i,j)$ the square at the $i$\\-th row from the top and $j$\\-th column from the left. We want to cover this grid wi","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc285_g"},"statements":[{"statement_type":"Markdown","content":"We have a grid with $H$ horizontal rows and $W$ vertical columns. We denote by square $(i,j)$ the square at the $i$\\-th row from the top and $j$\\-th column from the left.\nWe want to cover this grid with $1 \\times 1$ tiles and $1 \\times 2$ tiles so that no tiles overlap and everywhere is covered by a tile. (A tile can be rotated.)\nEach square has `1`, `2`, or `?` written on it. The character written on square $(i, j)$ is $c_{i,j}$.  \nA square with `1` written on it must be covered by a $1 \\times 1$ tile, and a square with `2` by a $1 \\times 2$ tile. A square with `?` may be covered by any kind of tile.\nDetermine if there is such a placement of tiles.\n\n## Constraints\n\n*   $1 \\leq H,W \\leq 300$\n*   $H$ and $W$ are integers.\n*   $c_{i,j}$ is one of `1`, `2`, and `?`.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$H$ $W$\n$c_{1,1}c_{1,2}\\ldots c_{1,W}$\n$\\vdots$\n$c_{H,1}c_{H,2}\\ldots c_{H,W}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc285_g","tags":[],"sample_group":[["3 4\n2221\n?1??\n2?21","Yes\n\nFor example, the following placement satisfies the conditions.\n![image](https://img.atcoder.jp/abc285/d984ec33355bac05ecebc41076d9a8df.png)"],["3 4\n2?21\n??1?\n2?21","No\n\nThere is no placement that satisfies the conditions."],["5 5\n11111\n11111\n11211\n11111\n11111","No"]],"created_at":"2026-03-03 11:01:13"}}