VK Cup 2018 - Round 2
A
Mystical Mosaic
Codeforces
1300
原题
←B →
翻译中…

There is a rectangular grid of $*n*$ rows of $*m*$ initially-white cells each.

翻译中…

Arkady performed a certain number (possibly zero) of operations on it. In the $*i*$-th operation, a non-empty subset of rows $*R*_{*i*}$ and a non-empty subset of columns $*C*_{*i*}$ are chosen. For each row $*r*$ in $*R*_{*i*}$ and each column $*c*$ in $*C*_{*i*}$, the intersection of row $*r*$ and column $*c*$ is coloured black.

翻译中…

There's another constraint: a row or a column can only be chosen at most once among all operations. In other words, it means that no pair of $(*i*, *j*)$ ($*i* < *j*$) exists such that image or image, where image denotes intersection of sets, and image denotes the empty set.

翻译中…

You are to determine whether a valid sequence of operations exists that produces a given final grid.

翻译中…

Input

翻译中…

The first line contains two space-separated integers $*n*$ and $*m*$ $(1 ≤ *n*, *m* ≤ 50$) — the number of rows and columns of the grid, respectively.

翻译中…

Each of the following $*n*$ lines contains a string of $*m*$ characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup.

翻译中…

Output

翻译中…

If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes).

翻译中…

You can print each character in any case (upper or lower).

翻译中…

Note

翻译中…

For the first example, the desired setup can be produced by $3$ operations, as is shown below.

翻译中…

image

翻译中…

For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence it won't be possible to colour the other cells in the center column.

翻译中…

样例

Input #1
5 8
.#.#..#.
.....#..
.#.#..#.
#.#....#
.....#..
Output #1
Yes
InputCopy OutputCopy
Input #2
5 5
..#..
..#..
#####
..#..
..#..
Output #2
No
InputCopy OutputCopy
Input #3
5 9
........#
#........
..##.#...
.......#.
....#.#.#
Output #3
No
InputCopy OutputCopy
题目信息
题号
924A
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。