3082.Appleman and Easy Task

Time Limit: 1s Memory Limit: 256MB

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 \times 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.

Input Format(From the terminal/stdin)

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

Output Format(To the terminal/stdout)

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

Sample Input 1

Copy
3
xxo
xox
oxx
 \n
   \n
   \n
   \n

Sample Output 1

Copy
YES
   \n

Sample Input 2

Copy
4
xxxo
xoxo
oxox
xxxx
 \n
    \n
    \n
    \n
    \n

Sample Output 2

Copy
NO
  \n

Submit

请先 登录

© 2025 FAQs