← 返回 meta 的题目列表AI Coding Maze: Preserve Start/End Symbols While Marking Path
类型:online_judge
You are given a maze grid (2D char matrix) containing S (start), E (end), # (wall), and . (open cell), plus an already-computed path. The current implementation replaces every cell on the path with *.
Modify the implementation so that:
Path cells that are . become *;
S and E must remain unchanged (never replaced);
All other cells remain unchanged.
Make the unit tests pass.
Constraints: R, C <= 200.
Example: Input:
S..
##.
..E
For a path (0,0)->(0,1)->(0,2)->(1,2)->(2,2), output:
S**
##*
..E
Example
Input
3 3
S..
##.
..E
5
0 0
0 1
0 2
1 2
2 2
Output
S**
##*
..E