CF1921G.Mischievous Shooter
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
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.
一位名叫谢尔(Shel)的顽皮而任性的射手,偶然间来到了一块尺寸为 n×m 的矩形场地,该场地被划分为若干单位方格。每个方格中要么有一个靶子,要么没有。
谢尔随身只带了一把“幸运散弹枪”,他可以用它朝四个方向之一射击:右下、左下、左上或右上。开枪时,散弹枪会击中所选方向上所有曼哈顿距离不超过固定常数 k 的靶子。两点 (x1,y1) 与 (x2,y2) 之间的曼哈顿距离定义为 ∣x1−x2∣+∣y1−y2∣。
当 k=3 时可能的命中区域。
谢尔的目标是尽可能多地击中靶子。请帮助他求出这个最大值。
输入格式
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.
每个测试包含若干测试用例。第一行包含一个整数 t(1≤t≤1000),表示测试用例的数量。随后是各测试用例的描述。
每个测试用例的第一行包含场地尺寸 n、m 以及散弹枪威力常数 k(1≤n,m,k≤105,且 1≤n⋅m≤105)。
接下来的 n 行,每行包含 m 个字符,表示场地的下一行:字符 '.' 表示该格子为空,字符 '#' 表示该格子中存在目标。
保证所有测试用例的 n⋅m 之和不超过 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:

语句中示例的可能最优射击方案:

输入解题思路,AI测评打分。不知道怎么写?