Problem2990--【Div1】搜索算法练习 - 同步玩家

2990: 【Div1】搜索算法练习 - 同步玩家

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Sample Input Copy

5
....#
#..#.
.P...
..P..
....#

Sample Output Copy

3

HINT

样例解释:
Let us call the player starting at (3,2) Player 1 and the player starting at (4,3) Player 2.

For example, doing the following brings the two players to the same cell in three moves:

Choose left. Player 1 moves to (3,1), and Player 2 moves to (4,2).

Choose up. Player 1 does not move, and Player 2 moves to (3,2).

Choose left. Player 1 does not move, and Player 2 moves to (3,1).

Source/Category