A1329 | [COCI-2015_2016-contest7]#6 PROZOR
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Young Marin, now already a respectable star of Croatian cinematography, spends his free time looking out the window. Unfortunately for him, the same activity is also taken up by a few flies that have landed on his window and are looking into the distance. Marin immediately hurried to get his square racket for killing flies. At the same time, he wondered how many flies it is possible to kill in one shot.
After trying to scare away the flies unsuccessfully for a few hours, he decided to ask for your help.
Marin has sent you a picture of his window, the dimensions being R × S pixels and has also told you the length of the side of the racket he uses to kill the flies, in pixels. Your task is to determine the maximal amount of flies that Marin could have killed in a single shot and mark one such shot in the picture.
After trying to scare away the flies unsuccessfully for a few hours, he decided to ask for your help.
Marin has sent you a picture of his window, the dimensions being R × S pixels and has also told you the length of the side of the racket he uses to kill the flies, in pixels. Your task is to determine the maximal amount of flies that Marin could have killed in a single shot and mark one such shot in the picture.
输入格式
The first line of input contains three integers R, S and K (3 6 K 6 R, S 6 100) that denote the dimensions of Marin’s picture and the length of the side of the racket.
Each of the following R lines contains S characters that describe Marin’s picture. The picture’s pixels marked with ’*’ denote the position of a fly, whereas all the other pixels are marked with ’.’ and denote empty space. On his window, there is at least one fly that Marin can kill with his racket.
Each of the following R lines contains S characters that describe Marin’s picture. The picture’s pixels marked with ’*’ denote the position of a fly, whereas all the other pixels are marked with ’.’ and denote empty space. On his window, there is at least one fly that Marin can kill with his racket.
输出格式
The first line of output must contain the maximal number of flies Marin can kill in a single shot.
The folllowing R lines must contain Marin’s picture, on it clearly marked a position of the racket that will ensure Marin kills as many flies as possible. The horizontal sides of the racket are denoted with a series of characters ’-’ and the vertical ones with ’|’, whereas angles are denoted with ’+’. For a more detailed explanation, consult the sample tests.
Please note: Marin’s racket will affect only the flies located strictly inside the racket, and the racket must be located inside the window with all its parts. In other words, it is assumed that the flies located at the sides of the racket will have enough time to fly away.
The folllowing R lines must contain Marin’s picture, on it clearly marked a position of the racket that will ensure Marin kills as many flies as possible. The horizontal sides of the racket are denoted with a series of characters ’-’ and the vertical ones with ’|’, whereas angles are denoted with ’+’. For a more detailed explanation, consult the sample tests.
Please note: Marin’s racket will affect only the flies located strictly inside the racket, and the racket must be located inside the window with all its parts. In other words, it is assumed that the flies located at the sides of the racket will have enough time to fly away.
输入输出样例
输入 #1
3 5 3 ..... .*.*. .....
输出 #1
1 +-+.. |*|*. +-+..
输入 #2
7 6 4 ...... .*.*.* ...... .*.*.. ..*... ..*... *....*
输出 #2
2 ...... .*.*.* +--+.. |*.|.. |.*|.. +--+.. *....*
输入 #3
9 9 6 ***...... ......*.* .*....*.. ..*...*.. ..*.*.... ..*....*. .....*... .*...***. .........
输出 #3
6 ***...... ......*.* .*....*.. ..*+----+ ..*|*...| ..*|...*| ...|.*..| .*.|.***| ...+----+
In test cases worth 50% of all points, it is sufficient to only have the first line of output correct.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted