CT1343

The Order Check at Greyfen

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Legend says the vault under the foggy moor of Greyfen opens only for a perfect tally of stamps. Lothar means to find out. 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 <= 100; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 10 849 379 1000 10 407 166 270 430 943 373
Output: NO

Example 2:

Input: 35 -28 79 159 167 170 183 191 199 206 228 252 253 332 344 365 372 468 491 550 632 679 686 692 755 766 810 827 856 892 902 926 936 971 987 1000
Output: YES

Example 3:

Input: 22 -69 -29 34 69 186 187 209 304 306 371 450 462 507 608 638 642 766 783 827 859 860 966
Output: YES

Constraints:

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

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