Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
Shortest Path for Bishop
Question:
You have some pieces (blocked cells) on the
chessboard and a bishop. Show at least in have
many moves the bishop can reach to the given
destination.
Input specification:
You will be first given 4 integers (x,y) coordinates
of starting and destination cells. Then, you will be
given an integer (n) the number of blocked cells.
Each of the following n lines will provide two
integers (x,y) coordinates of the blocked cells.
Output specification:
Show one integer.
Sample Input
2 6 7 5
4
3 3
3 5
3 7
5 3
|
Sample Output
8
|
Для отправки решений необходимо выполнить вход.
|