407115: GYM102697 086 Symmetry

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

086. Symmetrytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Bob has an array of integers, and Bob is curious whether or not his array is symmetrical on two axis of symmetry. Write a program that takes in an array of integers and outputs whether or not the array is symmetrical. The two axis of symmetry are the horizontal and the vertical. It is important to note that if an odd number of columns or rows is present, the middle row and/or column(s) should be considered the axis and should be completely ignored in the symmetry analysis. Integers are considered symmetrical if they are the same value across an axis of symmetry. Your program should only output "True" if the array is symmetrical on both the horizontal and vertical axis of symmetry.

Input

The first line contains two space separated integers, $$$R$$$ and $$$C$$$, respectively. These represent the number of rows and columns that are in the array. The next $$$R$$$ lines will each contain $$$C$$$ space-separated integers that represent the individual elements of the array.

Output

A single statement of "True" or "False" that indicated whether or not the array is symmetrical.

ExamplesInput
5 5
1 0 1 0 1
0 1 0 1 0
1 1 1 0 1
0 1 1 1 0
1 0 1 0 1
Output
True
Input
3 3
1 1 1
0 1 0
1 0 1
Output
True

加入题单

算法标签: