#P2060. [HNOI2006] 马步距离
[HNOI2006] 马步距离
Description
In international chess and Chinese chess (Xiangqi), the horse/knight moves in the same way, following an L shape. We call this movement a knight move.
As shown in the figure below, starting from the point labeled , you can reach a point labeled in one knight move, and a point labeled in two knight moves.

Given any two points and on the plane, with coordinates and respectively, from you can reach , , , , , , , in one knight move.
Assume the board is sufficiently large, and coordinates can be negative. Please compute the minimum number of knight moves needed to get from point to point .
Input Format
A single line containing four integers separated by spaces, representing .
Output Format
Output a single integer, the minimum number of knight moves from point to point .
1 2 7 9
5
Hint
Constraints
For of the testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号