#K3411. Palindrome Array Check

    ID: 25237 Type: Default 1000ms 256MiB

Palindrome Array Check

Palindrome Array Check

You are given an array of integers. Your task is to determine whether the array is a palindrome.

An array is considered a palindrome if it reads the same backward as forward. Formally, an array A of length n is a palindrome if for all indices i (0 ≤ i < n), the following holds:

\( A[i] = A[n-i-1] \)

If the given array is a palindrome, output YES; otherwise, output NO.

inputFormat

The input is provided via standard input (stdin) and has the following format:

  • The first line contains an integer n, representing the number of elements in the array.
  • The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single line to standard output (stdout):

  • YES if the array is a palindrome;
  • NO otherwise.
## sample
1
1
YES