#K8791. Mirrored Sequence Check
Mirrored Sequence Check
Mirrored Sequence Check
You are given an integer N and a sequence of N integers. Your task is to determine whether the sequence is a mirrored sequence (i.e., a palindrome).
A sequence A is mirrored if for every integer \( 0 \leq i < \frac{N}{2} \), the following condition holds:
\( A[i] = A[N-i-1] \)
If the condition is satisfied, output Yes
, otherwise output No
.
inputFormat
The input is given from stdin and consists of two lines:
- The first line contains a single integer N (1 ≤ N).
- The second line contains N space-separated integers representing the sequence A.
outputFormat
Print a single line to stdout containing Yes
if the given sequence is a mirrored sequence, or No
otherwise.
5
1 2 3 2 1
Yes