Chengdong的征途

TimeLimit:2000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

图片.png

这天chengdong在检测贪玩蓝月的时候,到了一个副本,副本介绍:“找到魔王一刀999级,橙装随便爆,金币捡捡检。。。”。但是chengdong发现里面的迷宫太简单了,魔王一下子就被发现了!chengdong反馈了这个问题后,贪玩蓝月就让chengdong来写一个代码,代码要求对随机给的一个n*m的迷宫,和一个k,要添加k堵墙;由此来增加游戏难度;但是chengdong觉得烦,就把这个任务交给了你,而且还根据他自己的美学对你提出了一个要求:你要让剩下的部分只有一个连通区域(设定是只能上下左右走);


Input

The first line contains three integers n, m, k (1 ≤ n, m ≤ 500, 0 ≤ k < s), where n and m are the maze's height and width, correspondingly, k is the number of walls Pavel wants to add and letter s represents the number of empty cells in the original maze.

Each of the next n lines contains m characters. They describe the original maze. If a character on a line equals ".", then the corresponding cell is empty and if the character equals "#", then the cell is a wall.


第一行输入三个整数n, m, k;(1<=n,m<=500, k<s, s是“.”的数量)

接下来n行,每行m个字符(“#”是墙, .”是路);


Output

Print n lines containing m characters each: the new maze that fits Pavel's requirements. Mark the empty cells that you transformed into walls as "X", the other cells must be left without changes (that is, "." and "#").

It is guaranteed that a solution exists. If there are multiple solutions you can output any of them.

输出也是一个n*m的迷宫,在这个迷宫里,要有k个“X”,表示这里将添加一堵墙。

保证有解,有多种方案时,随便输出一种。


SampleInput 1
3 4 2
#..#
..#.
#...
SampleOutput 1
#.X#
X.#.
#...
SampleInput 2
5 4 5
#...
#.#.
.#..
...#
.#.#
SampleOutput 2
#XXX
#X#.
X#..
...#
.#.#
Submit
题目统计信息详细
总AC数8
通过人数7
尝试人数7
总提交量13
AC率53.85%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: