https://www.luogu.com.cn/problem/CF16A题目描述
According to a new ISO standard, a flag of every country should have a chequered field n×mn×m , each square should be of one of 10 colours, and the flag should be «striped»: each horizontal row of the flag should contain squares of the same colour, and the colours of adjacent horizontal rows should be different. Berland's government asked you to find out whether their flag meets the new ISO standard.
输入格式
The first line of the input contains numbers nn and mm ( 1<=n,m<=1001<=n,m<=100 ), nn — the amount of rows, mm — the amount of columns on the flag of Berland. Then there follows the description of the flag: each of the following nn lines contain mm characters. Each character is a digit between 0 and 9, and stands for the colour of the corresponding square.
输出格式
Output YES, if the flag meets the new ISO standard, and NO otherwise.
根据新的IOS标准,每个国家的国旗应该由n*m个格子组成,其中每个格子最多有 1010 种不同的颜色。并且国旗应该有条纹:旗帜的每一行应包含相同颜色的方块,相邻的行的颜色应该是不同的。Berland 政府要求你找出他们的国旗是否符合新的 ISO 标准。
输入的第一行包含数 nn 和 mm,其中 nn 为行数,mm 为列数。接下来是对旗的描述:以下 nn 行中的每一行包含 mm 个字符。每个字符是 00 到 99 之间的数字,代表相应正方形的颜色。
如果国旗符合标准就输出 YES,否则输出 NO。