CT33108

Cora Counts the crates

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Cora runs the ropewalk at the mulberry rows of Silkmead. Today the books show a list of crates, and the numbers must be worked out before sundown. Task: The array is sorted non-decreasing. Print the 1-based position where x would be inserted to keep the order (before equal values). Input format: First line: n and x. Second line: n sorted integers. Output format: Print the insertion position (1..n+1). Constraints: 1 <= n <= 6877; -1000000 <= a[i],x <= 1000.

Example 1:

Input: 779 -908325 -999549 -999467 -997494 -997456 -996991 -996750 -995488 -995316 -995220 -994831 -992430 -988991 -988096 -987338 -986053 -985125 -976639 -974296 -973769 -971745 -969694 -969471 -969397 -969371 -966323 -965429 -962236 -960247 -960030 -959580 -957267 -956681 -955879 -954882 -951941 -951726 -950549 -950288 -949086 -948665 -948608 -946765 -943870 -943174 -943149 -942613 -940893 -940607 -937879 -937761 -936486 -936348 -934602 -934539 -934228 -930276 -930090 -929817 -928638 -928106 -927599 -923629 -923530 -922903 -922409 -921786 -920866 -916902 -915910 -915421 -915343 -913619 -912349 -911045 -910710 -910692 -908080 -906750 -906468 -904926 -900840 -900036 -898202 -891869 -890100 -889899 -888120 -887440 -886327 -883929 -882895 -882725 -882503 -882193 -881720 -878807 -878202 -878085 -877…
Output: 77

Example 2:

Input: 992 -733132 -998845 -998691 -997552 -996625 -996589 -993999 -993766 -991981 -989742 -989077 -986934 -986611 -986517 -986284 -984915 -984506 -982452 -981472 -981418 -979678 -979054 -978948 -976016 -975938 -974673 -974507 -972894 -971904 -969830 -969796 -969078 -968933 -968924 -968429 -967874 -967546 -966559 -964878 -964039 -963322 -963162 -962985 -961708 -961301 -960722 -959734 -956449 -955582 -954730 -953131 -953119 -951976 -951064 -950991 -950231 -950048 -949785 -949625 -949401 -948294 -947674 -947532 -946517 -945857 -944847 -944365 -941689 -941464 -940714 -940634 -939248 -935746 -934255 -933539 -933392 -933200 -933134 -931474 -930634 -930229 -930019 -930017 -929888 -928891 -928191 -927956 -927754 -927537 -926555 -926387 -925367 -924901 -924727 -922547 -921241 -920891 -919984 -919390 -918…
Output: 284

Example 3:

Input: 2465 -627371 -999970 -999766 -999751 -999249 -998860 -998671 -997095 -996640 -994909 -994778 -994578 -993669 -993572 -993513 -993140 -991201 -991018 -990790 -990772 -990532 -990284 -989741 -989723 -989623 -989047 -988683 -988533 -988414 -987876 -987297 -986967 -986914 -986826 -985390 -985386 -985014 -984735 -984591 -983030 -982042 -982032 -981645 -981588 -981570 -981401 -980966 -980505 -980133 -980063 -979755 -978842 -978331 -978112 -977722 -977574 -977163 -976547 -976282 -976032 -974924 -973975 -972755 -972739 -972680 -972194 -972012 -971796 -971691 -970748 -970347 -970315 -969936 -969697 -969627 -969599 -968813 -967993 -967729 -967392 -967208 -966854 -966506 -966221 -964761 -963497 -962985 -962724 -961958 -961859 -961390 -961350 -960996 -960933 -960356 -959513 -959061 -958744 -958347 -95…
Output: 884

Constraints:

1 <= n <= 6877; -1000000 <= a[i],x <= 1000.

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