A higher resolution is required to access the IDE
- 93
Statement
Goal
You need to move a chess knight between the pointsA chess knight moves in an L shaped pattern, like so:
.X.X.
X...X
..B..
X...X
.X.X.
The
There may be other chess pieces on the board, blocking the knight's movement, but for clarity, you will only be notified of where you cannot go by
Your goal is to find how many turns
Input
Line 1: Two integers W and H giving the width and height of the board.
H next lines: A row of the board, containing the charactersB , E , . and #
H next lines: A row of the board, containing the characters
Output
One line, giving the minimum number of turns N needed to go from B to E , or Impossible .
Constraints
2 ≤ W, H ≤ 8
Example
Input
3 2 ..E B..
Output
1
A higher resolution is required to access the IDE