#00039D

sahtabla

There are n pieces and one knight. What is the smallest number of moves that the knight need in order to capture all the pieces.



InputThe first line contains three integers n, r and [] (1 <= n <= 10, 1 <= r, c <= 8) representing the number of pieces, the row and column of the knight's position. Each of the following n lines contain two integers from the interval [1, 8] representing the row and the column of the piece's position.

OutputOutput one integer - the smallest number of moves the Knight needs to capture all the pieces.

Input:
[c]2 1 7
2 2
3 8

Output:
4
Explanation:
The knight could move: (1, 7) -> (3, 8) -> (4, 6) -> (3, 4) -> (2, 2).

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.