Palindrome Array
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
256M
Author:
Problem types
Allowed languages
Python
An array \(A\) of length \(N\) is a palindrome if \(A_i = A_{N-i+1}\) for every \(1 \le i \le N\). Determine whether the given array is a palindrome.
Input
The first line contains \(N\). The second line contains \(N\) integers \(A_i\).
The input satisfies:
- \(1 \le N \le 10^5\)
- \(|A_i| \le 10^9\)
Output
Print YES if A is a palindrome; otherwise, print NO.
Example
Input
5
1 2 3 2 1
Output
YES
Comments