时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒 空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M Special Judge, 64bit IO Format: %lld
题目描述
Given two even integers and , construct a matrix satisfying following constraints:
The number of rows and columns of are and respectively.
For each integer , appears exactly once in .
For each two adjacent integers and , denoting and , then holds.
The number of turning integers is exactly , where is a turning integer iff the three integers , and are not in the same row or the same column.
If multiple solution exist, print any one of them. If no solution exist, report it.
输入描述:
The only line contains two even integers and .
输出描述:
If no solution, print "No" (without quotes) in one line. If solution exists, print "Yes" (without quotes) in the first line. Then print lines each containing integers , denoting the answer matrix.