CT28073

Gautam's Vermilion vials

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Gautam the assayer watches over the marble forum of Argentium's stores of vials. 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 <= 702; -1000000000 <= a[i],x <= 1000000.

Example 1:

Input: 654 -930383827 -999665432 -999245464 -999048500 -996855059 -995835895 -995523497 -994666675 -991787969 -991402194 -989601435 -988365861 -987531042 -985619771 -981940875 -981560999 -981482657 -978107539 -975159457 -970996780 -969437262 -969050376 -968725065 -966674210 -966319672 -965705981 -964466908 -964137235 -963385255 -963249301 -962750691 -959215422 -955260408 -955000522 -954674493 -951810214 -951192239 -945850245 -943913155 -943586436 -942439545 -942105200 -941785881 -941716298 -939604344 -938955441 -938484787 -938441911 -936962220 -936949924 -934864311 -933926024 -933736294 -931329630 -929433952 -927702654 -926555127 -925146084 -923567638 -922602279 -921596429 -920771595 -918512083 -917025062 -911135606 -908713281 -907406927 -905557025 -904791749 -903884428 -901618172 -900781043 -899…
Output: 54

Example 2:

Input: 362 -982935318 -999448223 -997873790 -992869957 -990175481 -989633357 -988351032 -977154191 -976267626 -973777690 -964936200 -963263792 -960050958 -957271611 -956539148 -956353036 -951399639 -948676284 -947988021 -947703711 -941973749 -941830251 -938202804 -936804531 -932623711 -932575741 -929370080 -928625506 -922398127 -918912053 -918713393 -918108021 -916575515 -912742391 -912310783 -911749358 -910289050 -908734025 -899452715 -898693572 -895344539 -894001843 -887063660 -883194429 -882901944 -879864095 -875282607 -874225072 -873286808 -872661444 -871515167 -870661496 -868163244 -865285034 -863070714 -862688400 -861204334 -860641757 -857472102 -851755368 -849303426 -847209207 -844189443 -841548374 -835735135 -833739751 -832047880 -820416129 -820360621 -820207827 -816350102 -815553551 -813…
Output: 7

Example 3:

Input: 701 -20723877 -999370894 -999342421 -998889728 -998319286 -998121091 -996687224 -995087520 -993056716 -990395609 -990339756 -988112537 -986574765 -983993120 -979950168 -979196698 -979054369 -976463283 -975444074 -974496441 -973539894 -973085976 -972426723 -972176049 -971851261 -971850841 -968467670 -967852716 -966818271 -966354139 -965906708 -963665799 -958027038 -956839186 -956756606 -955964911 -955782137 -955699534 -954146833 -953976301 -953431923 -948847441 -945683554 -944828703 -944658146 -943340076 -943270798 -938822019 -938572657 -936717031 -934243326 -933742548 -932498046 -928016557 -927044720 -918045291 -915688188 -912811667 -912436394 -912008117 -911706756 -908372511 -908312276 -908140890 -907189285 -906801985 -900189594 -899927114 -899479902 -893658210 -890899012 -890521345 -8904…
Output: 690

Constraints:

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

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