CT1960

Koda Counts the ingots

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Koda runs the depot at the bamboo terraces of Verdantstep. Today the books show a list of ingots, and the numbers must be worked out before sundown. Task: Read n integers and print YES if the array is sorted in non-decreasing order, otherwise NO. Input format: First line: n. Second line: n space-separated integers. Output format: Print YES or NO. Constraints: 1 <= n <= 21; -100 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 14 5 -54 -99 -68 -4 -98 -28 10 -94 -2 5 -40 -60 -51
Output: NO

Example 2:

Input: 21 -76 -55 -55 -17 -73 -97 10 -37 -22 9 -41 5 -98 -89 -91 -76 -47 -40 -64 -69 -61
Output: NO

Example 3:

Input: 20 -90 -77 -75 -72 -72 -64 -63 -53 -52 -46 -33 -29 -28 -27 -24 -21 -17 -8 -7 0
Output: YES

Constraints:

1 <= n <= 21; -100 <= a[i] <= 10; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.