304863: CF924A. Mystical Mosaic
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Mystical Mosaic
题目描述
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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF924A/970bfdc984412d650a4edcfe5e0a8df4329d1b0b.png) or ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF924A/74963b959d98ef5a1623c0fa6c3ddc72e6be47dd.png), where ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF924A/f53ec93ace7ac116d42268fc65398baf94289b39.png) denotes intersection of sets, and ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF924A/a8551b5381914bb6ecc9b38259329c2377122e54.png) denotes the empty set. You are to determine whether a valid sequence of operations exists that produces a given final grid.输入输出格式
输入格式
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.
输出格式
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).
输入输出样例
输入样例 #1
5 8
.#.#..#.
.....#..
.#.#..#.
#.#....#
.....#..
输出样例 #1
Yes
输入样例 #2
5 5
..#..
..#..
#####
..#..
..#..
输出样例 #2
No
输入样例 #3
5 9
........#
#........
..##.#...
.......#.
....#.#.#
输出样例 #3
No