Palindrome array - MarisaOJ: Marisa Online Judge

Palindrome array

Time limit: 1000 ms
Memory limit: 256 MB
Determine whether or not an array $A$ of length $n$ is a palindrome (reads the same backwards as forwards, for example `32123`). ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - Print `YES` if $A$ is a Palindrome, `NO` otherwise. ### Constraints - $1 \le n \le 1000$. - $|A_i| \le 1000 $. ### Example Input: ``` 4 1 2 2 1 ``` Output: ``` YES ```