#t448. 最小步数
最小步数
Two Horses
Problem Description
In board games a piece always moves in a fixed way; for example, in Chinese chess the horse moves in the 日 shape. A schoolboy wondered whether the game would be more fun if the horse had two kinds of moves. So he ruled that the horse may move either in the 日 shape or, like the elephant, in the 田 shape.
His desk-mate, who likes Go, found this interesting and decided to try it on a Go board. Choose two points and ; put a black stone at and a white stone at , representing the two horses. A piece may move in either the 日 or the 田 shape. One player moves the black horse, the other moves the white horse. Whoever reaches the upper-left corner in the fewest moves wins.
Given the coordinates of and , find the minimum number of moves each horse needs to reach .
Input Format
The coordinates of points and .
Output Format
The minimum number of moves for each horse.
Sample Input
12 16
18 10
Sample Output
8
9
Limitation
1 s, 1024 KiB for each test case.