CT909

Surveyor's Ledger of ingots

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Caravans arrive at the coastal hub of Tidewater with crates of ingots, and Surveyor the inventory keeper must account for every last one. 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 <= 33; -100 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 22 37614 60807 70677 123671 179661 191532 198569 273433 504912 545994 558683 626249 647539 705888 796195 815222 845034 860535 873586 928819 969014 976076
Output: YES

Example 2:

Input: 27 876336 783674 906945 92916 342810 763758 444830 518031 335359 859707 361142 506938 418624 324396 1000000 632597 113992 927059 552157 780773 480348 898256 718602 285325 206825 178351 23403
Output: NO

Example 3:

Input: 18 687911 574462 713248 847446 631027 430133 127592 1000000 263659 465193 934383 96922 743991 782060 878192 222992 827488 126623
Output: NO

Constraints:

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

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