题目描述
Problem Description
Niwango found a grid of squares with $ H $ rows and $ W $ columns. Niwango wants to know how to fill all the squares with 2 or 5 while satisfying the following conditions:
- When focusing only on the squares with
2, and considering a graph where edges are drawn between adjacent squares (including diagonally), the size of all connected components should be $ 2 $. - When focusing only on the squares with
5, and considering a graph where edges are drawn between adjacent squares (excluding diagonally), the size of all connected components should be $ 5 $.
Determine if such a filling method exists, and if it does, provide an example.
Input Format
The input is given from the standard input in the following format:
$ H $ $ W $
Output Format
If a filling method satisfying the conditions exists, output Yes. Otherwise, output No. If it exists, output the filling method starting from the second line in the following format. $ c_{i,j} $ is the integer written in the square at the $ i $-th row and $ j $-th column.
$ c_{11} $ $\cdots$ $ c_{1W} $ $\vdots$ $ c_{H1} $ $\cdots$ $ c_{HW} $
Sample Input and Output
Sample Input #1
1 2
Sample Output #1
Yes
22
Sample Input #2
1 1
Sample Output #2
No
Notes/Hints
Constraints
- All given inputs are integers.
- $1 \leq H, W \leq 2525$
Sample Explanation 1
22is the only filling method that satisfies the conditions.- Note that
55violates the condition that the size of all connected components should be $ 5 $.
Sample Explanation 2
- If no filling method satisfies the conditions, output
No.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分