308814: CF1579C. Ticks
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Ticks
题意翻译
$n \times m$ 的棋盘,左上角和右下角坐标分别为 $(1, 1), (n, m)$,一开始每个格子为白色。 每次操作可以选择一个格子 $(x, y)$ 以及左上角和右上角方向的 $d$ 个连续格子染成黑色,并将其称为一个大小为 $d$ 的对勾图案。如果多个对勾图案重复对一个格子染色,该格子颜色保持黑色不变。 现在给你一个棋盘,请问棋盘上的黑色格子是否可以由若干个大小至少为 $k$ 的对勾图案染色而成。题目描述
Casimir has a rectangular piece of paper with a checkered field of size $ n \times m $ . Initially, all cells of the field are white. Let us denote the cell with coordinates $ i $ vertically and $ j $ horizontally by $ (i, j) $ . The upper left cell will be referred to as $ (1, 1) $ and the lower right cell as $ (n, m) $ . Casimir draws ticks of different sizes on the field. A tick of size $ d $ ( $ d > 0 $ ) with its center in cell $ (i, j) $ is drawn as follows: 1. First, the center cell $ (i, j) $ is painted black. 2. Then exactly $ d $ cells on the top-left diagonally to the center and exactly $ d $ cells on the top-right diagonally to the center are also painted black. 3. That is all the cells with coordinates $ (i - h, j \pm h) $ for all $ h $ between $ 0 $ and $ d $ are painted. In particular, a tick consists of $ 2d + 1 $ black cells. An already painted cell will remain black if painted again. Below you can find an example of the $ 4 \times 9 $ box, with two ticks of sizes $ 2 $ and $ 3 $ . ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1579C/b2b898f1569af103ffaf93cfc9bbbe7d51da03c3.png)You are given a description of a checkered field of size $ n \times m $ . Casimir claims that this field came about after he drew some (possibly $ 0 $ ) ticks on it. The ticks could be of different sizes, but the size of each tick is at least $ k $ (that is, $ d \ge k $ for all the ticks). Determine whether this field can indeed be obtained by drawing some (possibly none) ticks of sizes $ d \ge k $ or not.输入输出格式
输入格式
The first line contains an integer $ t $ ( $ 1 \leq t \leq 100 $ ) — the number test cases. The following lines contain the descriptions of the test cases. The first line of the test case description contains the integers $ n $ , $ m $ , and $ k $ ( $ 1 \le k \le n \le 10 $ ; $ 1 \le m \le 19 $ ) — the field size and the minimum size of the ticks that Casimir drew. The following $ n $ lines describe the field: each line consists of $ m $ characters either being '.' if the corresponding cell is not yet painted or '\*' otherwise.
输出格式
Print $ t $ lines, each line containing the answer to the corresponding test case. The answer to a test case should be YES if the given field can be obtained by drawing ticks of at least the given size and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes, and YES will all be recognized as positive answers).
输入输出样例
输入样例 #1
8
2 3 1
*.*
...
4 9 2
*.*.*...*
.*.*...*.
..*.*.*..
.....*...
4 4 1
*.*.
****
.**.
....
5 5 1
.....
*...*
.*.*.
..*.*
...*.
5 5 2
.....
*...*
.*.*.
..*.*
...*.
4 7 1
*.....*
.....*.
..*.*..
...*...
3 3 1
***
***
***
3 5 1
*...*
.***.
.**..
输出样例 #1
NO
YES
YES
YES
NO
NO
NO
NO