Professor Oak has written another problem for a competition (the OIcat). The statement reads:
“Consider an board with obstacles. We must go from the upper-left cell to the lower-right cell, making horizontal and vertical moves, never leaving the board, and never going through an obstacle…”
Later:
”In the given test cases, both and will be between 1 and 100, and the number of paths of minimum length will belong to …”
What is required in that problem is irrelevant here. The issue is that now Prof. Oak must create those boards. Can you help him?
Input consists of several cases, each with a natural between 1 and .
For each
,
print first a line with
and
(both between 1 and 100), followed by
lines with
characters each: a ‘.’ indicates a free cell, and an
‘X’ indicates an obstacle. The board must have exactly
paths of minumum length. Since, in general, there will be more than one
solution, print any of them. Print a line with 10 dashes at the end of
each case. Follow strictly the format of the sample output.
Input
1 1 3 12 7 11628
Output
1 1 . ---------- 7 9 .X....... ...XXXXX. .X.XXX... .X.XXX.XX .X...X... .X.X...X. ...X.XXX. ---------- 5 10 .XX.X...X. ......X... .XXXX...X. .X...XXXX. ...X...... ---------- 2 11 ...X......X X.....X.... ---------- 6 6 ...... .XXX.. ..XX.. ..XXX. ..XXX. ...... ---------- 6 15 ............... ............... ............... ............... ............... ............... ----------