Symmetric Logos


Submit solution

Points: 10 (partial)
Time limit: 5.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
C

AIM:

Find Symmetric Logos.

How to check whether a logo is symmetric?

Align the center of logo with the origin of Cartesian plane. Now if the coloured pixels of the logo are symmetric about both X-axis and Y-axis, then the logo is symmetric.

You are given a binary matrix of size N x N which represents the pixels of a logo. 1 indicates that the pixel is coloured and 0 indicates no colour.

For instance: Take a 5x5 matrix as follows:

01110

01010

10001

01010

01110

It can be graphically represented as:

enter image description here

Observe that it is symmetric about both X-axis and Y-axis.

Let's take another example of 5x5 matrix:

Graphically it is represented as follows:

enter image description here

Now this logo is symmetric about Y-axis but it is not symmetric about X-axis.

Your task is to output YES if the logo is symmetric else output NO.

Input Format:

First line of each test case contains the N - size of matrix.

Next N lines contains binary strings of length N.

Output Format:

Print YES or NO in a new line for each test case

Sample Input:

4

0101

0110

0110

0101

Sample Output:

NO


Comments

There are no comments at the moment.