Rook, Bishop and King

题意翻译

【题目描述】 佩蒂亚正在学习国际象棋。他已经学会如何移动王、车和象。让我们提示你如何移动国象棋子。棋盘有$64$个棋格,呈$8\times8$正方形。一个格子可以用$(r,c)$来表示——$r$指行,$c$指列(虽然在经典棋局中用字母和数字一起表示)。每一个棋子占用一个棋格。一次合法的棋步就是执行如下之一: - 车可以横向或纵向移动任意格。 - 象可以斜着移动任意格。 - 王可以任意方向移动一格——横着或者斜着。 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF370A/56990885d6c1103e4bcb4658b8f866fa3cac82a1.png) 佩蒂亚在想,从$(r_1,c_1)$移动到$(r_2,c_2)$所需的最少步数是多少?我们假设在棋盘上只有一枚棋子。帮他解决问题。 【输入格式】 输入包括四个整数$r_1,c_1,r_2,c_2(1<=r_1,c_1,r_2,c_2<=8)$——分别代表出发的棋格和目的地棋格。数据保证两个格子不相同。你可以假设棋盘的行从上到下是$1$到$8$,棋盘从左到右是$1$到$8$。 【输出格式】 输出三个用空格分隔的整数,分别代表车、象、王从$(r_1,c_1)$移动到$(r_2,c_2)$所需的最少步数。如果无法移动到,则输出$0$。

题目描述

Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an $ 8×8 $ table. A field is represented by a pair of integers $ (r,c) $ — the number of the row and the number of the column (in a classical game the columns are traditionally indexed by letters). Each chess piece takes up exactly one field. To make a move is to move a chess piece, the pieces move by the following rules: - A rook moves any number of fields horizontally or vertically. - A bishop moves any number of fields diagonally. - A king moves one field in any direction — horizontally, vertically or diagonally. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF370A/56990885d6c1103e4bcb4658b8f866fa3cac82a1.png)The pieces move like thatPetya is thinking about the following problem: what minimum number of moves is needed for each of these pieces to move from field $ (r_{1},c_{1}) $ to field $ (r_{2},c_{2}) $ ? At that, we assume that there are no more pieces besides this one on the board. Help him solve this problem.

输入输出格式

输入格式


The input contains four integers $ r_{1},c_{1},r_{2},c_{2} $ ( $ 1<=r_{1},c_{1},r_{2},c_{2}<=8 $ ) — the coordinates of the starting and the final field. The starting field doesn't coincide with the final one. You can assume that the chessboard rows are numbered from top to bottom 1 through 8, and the columns are numbered from left to right 1 through 8.

输出格式


Print three space-separated integers: the minimum number of moves the rook, the bishop and the king (in this order) is needed to move from field $ (r_{1},c_{1}) $ to field $ (r_{2},c_{2}) $ . If a piece cannot make such a move, print a 0 instead of the corresponding number.

输入输出样例

输入样例 #1

4 3 1 6

输出样例 #1

2 1 3

输入样例 #2

5 5 5 6

输出样例 #2

1 0 1