2962: 马的遍历

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:94 Solved:36

Description

有一个N*M 的棋盘,在某个点 (x,y) 上有一个马,要求你计算出马到达棋盘上任意一个点最少要走几步。

Input

输入只有一行四个整数,分别为 N,M,x,y。

Output

一个$n*m$的矩阵,代表马到达某个点最少要走几步(不能到达则输出 -1 )。

Sample Input Copy

3 3 1 1

Sample Output Copy

0 3 2
3 -1 1
2 1 4

HINT

数据规模与约定

对于全部的测试点,保证1<= x , y <= N,M<=400