#C5826. Taco Garden Flower Planting

    ID: 49518 Type: Default 1000ms 256MiB

Taco Garden Flower Planting

Taco Garden Flower Planting

Given an \(n \times m\) garden represented as a grid, each cell is either occupied by a flower (denoted by *) or is empty (denoted by .). You are to determine whether it is possible to plant a new flower in one of the empty cells such that the new flower does not share its row or column with any other flower.

Formally, if the garden is represented by a matrix \(G\) with \(n\) rows and \(m\) columns, you need to decide if there exists a cell \((i,j)\) where \(G_{i,j} = '.'\) and there is no cell in row \(i\) or column \(j\) with a pre-existing flower (i.e. a cell with *). If such a cell exists, output YES; otherwise, output NO.

Note: The new flower must be the only flower in its row and column.

inputFormat

The input is read from standard input (stdin). The first line contains two integers (n) and (m), representing the number of rows and columns of the garden respectively. This is followed by (n) lines, each containing a string of length (m) consisting of the characters * and ..

outputFormat

Output a single line to standard output (stdout) containing YES if it is possible to plant a new flower according to the rules, or NO otherwise.## sample

4 4
.*..
....
..*.
....
YES