#K74562. Check Non-decreasing Array

    ID: 34225 Type: Default 1000ms 256MiB

Check Non-decreasing Array

Check Non-decreasing Array

Given an array of integers, determine if the array is non-decreasing. In other words, check if for every index (i) (where (1 \le i < n)), the condition (a_i \ge a_{i-1}) holds. Output YES if the entire array is non-decreasing; otherwise, output NO.

inputFormat

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 array elements.

outputFormat

Output a single line containing YES if the array is non-decreasing, otherwise output NO.## sample

5
1 2 2 3 5
YES

</p>