测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A9635. Appleman and Easy Task

编程题 普及/提高-

题目描述

Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?

Given a $n×n$ checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the board are adjacent if they share a side.

输入格式

The first line contains an integer $n$ ( $1<=n<=100$ ). Then $n$ lines follow containing the description of the checkerboard. Each of them contains $n$ characters (either 'x' or 'o') without spaces.

输出格式

Print "YES" or "NO" (without the quotes) depending on the answer to the problem.

输入输出样例

输入 #1
3
xxo
xox
oxx
输出 #1
YES
输入 #2
4
xxxo
xoxo
oxox
xxxx
输出 #2
NO
上一题 去做题 下一题