CF1921G.Mischievous Shooter
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Once the mischievous and wayward shooter named Shel found himself on a rectangular field of size n×m , divided into unit squares. Each cell either contains a target or not.
Shel only had a lucky shotgun with him, with which he can shoot in one of the four directions: right-down, left-down, left-up, or right-up. When fired, the shotgun hits all targets in the chosen direction, the Manhattan distance to which does not exceed a fixed constant k . The Manhattan distance between two points (x1,y1) and (x2,y2) is equal to ∣x1−x2∣+∣y1−y2∣ .
Possible hit areas for k=3 .Shel's goal is to hit as many targets as possible. Please help him find this value.
输入格式
Each test consists of several test cases. The first line contains a single integer t ( 1≤t≤1000 ) — the number of test cases. Then follows the description of the test cases.
The first line of each test case contains field dimensions n , m , and the constant for the shotgun's power k ( 1≤n,m,k≤105,1≤n⋅m≤105 ).
Each of the next n lines contains m characters — the description of the next field row, where the character '.' means the cell is empty, and the character '#' indicates the presence of a target.
It is guaranteed that the sum of n⋅m over all test cases does not exceed 105 .
输出格式
For each test case, output a single integer on a separate line, which is equal to the maximum possible number of hit targets with one shot.
输入输出样例
输入#1
4 3 3 1 .#. ### .#. 2 5 3 ###.. ...## 4 4 2 ..## ###. #..# #### 2 1 3 # #
输出#1
3 4 5 2
说明/提示
Possible optimal shots for the examples in the statement: