|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
After an exhausting battle, the invading army is finally defeated. The king sends his only surviving knight to the kingdom’s capital to tell the people of your victory. This might be a very (very!) long journey.
The knight moves as on a chessboard: in each move, he travels two squares in one of the four compass directions, and one more square sideways. During his journey, he must remain inside the kingdom to avoid starting any new wars. The kingdom is a NX × NY rectangular grid, which is possibly much (much!) larger than the 8 × 8 board on which the battle was fought. The rows and columns in this kingdom are numbered from 0. The knight starts at square KX, KY, and must travel to the capital at square CX, CY. Output the smallest number of moves in which the knight can reach the capital.
Figure 4: The possible moves for a knight.
The input consists of three lines, each containing two integers:
Output a single line containing a single integer, the number of moves the knight will need to get to the capital.
8 8 0 0 7 7
1000 7000 253 6789 253 6789
8 1000000000 3 3 3 999999999