#K54742. Consistent Plant Growth
Consistent Plant Growth
Consistent Plant Growth
You are given measurements for t plants. For each plant, the measurements are provided in a single line where the first integer (k) represents the number of measurements for that plant, followed by (k) integers denoting its height on consecutive days. A plant exhibits consistent growth if its height never decreases from one measurement to the next, i.e. for measurements (h_1, h_2, \dots, h_k), it must hold that (h_1 \le h_2 \le \dots \le h_k). Your task is to determine for each plant if it shows consistent growth. Output "YES" if it does, otherwise output "NO" for that plant.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (t) denoting the number of plants. Each of the next (t) lines corresponds to one plant. In each such line, the first integer is (k) (the number of measurements), followed by (k) space-separated integers representing the height measurements.
outputFormat
For each plant, output a line to standard output (stdout) with "YES" if the plant has consistent (non-decreasing) growth and "NO" otherwise.## sample
3
4 2 3 3 5
3 5 4 6
5 1 2 2 2 3
YES
NO
YES
</p>