QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 64 MB مجموع النقاط: 80

#14592. 窗户

الإحصائيات

克罗地亚电影界备受瞩目的年轻新星 Marin 正闲着没事看窗外。不幸的是,几只落在窗户上眺望远方的苍蝇也加入了这一行列。Marin 立即赶去拿他那把用于拍苍蝇的正方形苍蝇拍。同时,他想知道一次最多能拍死多少只苍蝇。在徒劳地尝试驱赶苍蝇几个小时后,他决定向你寻求帮助。

Marin 给你发了一张他窗户的照片,尺寸为 $R \times S$ 像素,并告诉了他用来拍苍蝇的苍蝇拍的边长 $K$(单位为像素)。你的任务是确定 Marin 在一次拍击中最多可以拍死多少只苍蝇,并在照片中标记出这样的一次拍击。

输入格式

第一行包含三个整数 $R, S$ 和 $K$($3 \le K \le R, S \le 100$),分别表示 Marin 照片的尺寸和苍蝇拍的边长。

接下来的 $R$ 行,每行包含 $S$ 个字符,描述 Marin 的照片。照片中标记为 * 的像素表示苍蝇的位置,而所有其他标记为 . 的像素表示空白区域。窗户上至少有一只 Marin 可以用苍蝇拍拍死的苍蝇。

输出格式

第一行必须包含 Marin 在一次拍击中最多可以拍死的苍蝇数量。

接下来的 $R$ 行必须包含 Marin 的照片,并在照片上清晰地标记出苍蝇拍的位置,以确保 Marin 能拍死尽可能多的苍蝇。苍蝇拍的水平边用字符 - 表示,垂直边用 | 表示,而四个角用 + 表示。更详细的说明请参考样例。

请注意:Marin 的苍蝇拍只会影响严格位于苍蝇拍内部的苍蝇,且苍蝇拍的所有部分都必须位于窗户内部。换句话说,假设位于苍蝇拍边缘(边界上)的苍蝇将有足够的时间飞走。

子任务

在价值 50% 分数的测试用例中,只需第一行输出(即最多可以拍死的苍蝇数量)正确即可。

样例

输入样例 1

3 5 3
.....
.*.*.
.....

输出样例 1

1
+-+..
|*|*.
+-+..

输入样例 2

7 6 4
......
.*.*.*
......
.*.*..
..*...
..*...
*....*

输出样例 2

2
......
.*.*.*
+--+..
|*.|..
|.*|..
+--+..
*....*

输入样例 3

9 9 6
***......
......*.*
.*....*..
..*...*..
..*.*....
..*....*.
.....*...
.*...***.
.........

输出样例 3

6
***......
......*.*
.*....*..
..*+----+
..*|*...|
..*|...*|
...|.*..|
.*.|.***|
...+----+

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.