CT23122

The Insertion Slot at Galeholm

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Zephyr the bookkeeper watches over the zephyr cliffs of Galeholm's stores of shelves. A careful computation stands between order and chaos. 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 <= 692; -1000000000 <= a[i],x <= 1000000000.

Example 1:

Input: 321 183212471 -997185990 -993618863 -991366523 -982312156 -968847180 -945669589 -941380295 -939082753 -934361483 -929579153 -926247668 -919124058 -912665915 -910845329 -909844840 -909212946 -901071491 -887395385 -885755569 -869231180 -865989228 -864810627 -859766450 -854944006 -850834970 -850715302 -850607227 -846505642 -840245487 -826188747 -825999473 -824058857 -800362820 -796448332 -793531529 -793353528 -786894283 -781103665 -780025427 -779791890 -766490672 -757311200 -756728271 -753844422 -751626345 -738477646 -733873340 -725926418 -722776611 -711047808 -710583605 -708506134 -703367081 -690192035 -685187575 -678889740 -665944337 -662017922 -652222669 -651678824 -647935667 -637684270 -631695920 -624177753 -615900369 -615788099 -611128299 -610770078 -610511630 -606762508 -604022527 -6026…
Output: 203

Example 2:

Input: 479 669707907 -994887896 -991645752 -989168397 -988699336 -985010587 -974576345 -973216215 -957141972 -947054269 -943790891 -936605151 -934883135 -932098378 -925738746 -913621420 -913288415 -908637470 -907235988 -902542590 -895950337 -895745219 -891313829 -886735010 -886419374 -883757013 -882427643 -878782474 -876416748 -874004830 -873059610 -871032536 -866775007 -866480651 -866462207 -862784864 -855112683 -854865884 -848229013 -846109384 -840765612 -833182767 -812901285 -811758758 -803714833 -803363410 -802363490 -801474993 -795635828 -792921811 -792388828 -790116508 -788854210 -783199793 -780538640 -773391036 -773274241 -770677972 -769905906 -764116882 -758094059 -754539324 -750697704 -750062010 -747988001 -747405030 -747006737 -745922850 -745603225 -741919554 -740962784 -740169591 -7358…
Output: 401

Example 3:

Input: 303 -121493623 -992785555 -985415198 -983899569 -964067091 -960507570 -934867580 -933988748 -931225101 -928958093 -927849890 -923179690 -910981192 -904543329 -900352609 -899426630 -883720960 -867521558 -859727120 -848777341 -846621630 -840111494 -835662353 -828641012 -827901072 -819981134 -805638604 -800189746 -797201429 -796984532 -782131258 -770077710 -762638841 -759902141 -739252316 -733994978 -723330715 -711658450 -702591096 -701735835 -698541678 -691529295 -689203975 -681589264 -679490372 -675380898 -673841496 -671333000 -667394174 -663420193 -647343332 -646927553 -642818031 -642015834 -632251363 -628280245 -625657516 -616558694 -606603151 -595317552 -595209922 -586690663 -573227819 -559445562 -558352709 -552644642 -529092144 -524999945 -521529044 -517127399 -516319496 -511892324 -506…
Output: 131

Constraints:

1 <= n <= 692; -1000000000 <= a[i],x <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
The Insertion Slot at Galeholm - EASY Coding Problem | CodeTikki