2243: 棋盘的马
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:31
Solved:15
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≤n≤400,1≤y≤m≤400。