CT892

Maya's Whispering crates

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Every season at the rookery of Crowhaven, someone must price the new merchandise line. This year the task falls to Maya, armed only with the crates register. 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 <= 51; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 26 -951279 1000000 -490847 7146 -739515 -695586 545143 441128 -526516 888486 -238431 -942954 604298 -211719 -545899 -248254 952879 180319 194203 -233518 798963 396418 -987607 443664 871081 441201
Output: NO

Example 2:

Input: 26 -954977 -938753 -933511 -821048 -773402 -658394 -624324 -596326 -545555 -462691 -449071 -226411 -197696 -131371 -96942 -12901 105635 165986 208997 253632 523258 606658 686788 853343 888851 940734
Output: YES

Example 3:

Input: 13 522845 -401456 -756492 -477122 -28937 -495720 508448 1000000 577629 -135552 557612 -996510 -935652
Output: NO

Constraints:

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

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