CT27587

The Caramel vials of Rohan

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

In the copper works of Verdigris, Rohan the cartographer keeps careful count of the vials. Price the new merchandise line, every figure matters. 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 <= 656; -1000000000 <= a[i],x <= 1000000000.

Example 1:

Input: 584 528526056 -985259198 -979047641 -965492461 -961408532 -960818104 -960485031 -953540870 -948866554 -939757433 -939124656 -937934662 -936663211 -933127529 -932973367 -932171220 -931834098 -930139193 -929387826 -929181604 -927627539 -926819503 -925254205 -921136686 -919378008 -918151218 -909690374 -902385221 -900511392 -898316388 -896181057 -895666771 -894286926 -891222209 -891046960 -888381794 -883710926 -880677968 -874458432 -866112671 -864764240 -864487831 -857342137 -855294943 -854861253 -852751265 -848284537 -847603605 -847484192 -847212794 -846535703 -844026384 -844010801 -841022616 -836900321 -836887143 -833739781 -823252716 -822179206 -819221135 -814997788 -811003079 -803418158 -800555469 -794965211 -794912662 -792315167 -791598155 -790832511 -786852562 -781509572 -781495602 -7801…
Output: 441

Example 2:

Input: 140 -28575205 -989541365 -988349287 -965665077 -944379937 -925641481 -922495036 -900972113 -890976518 -877518198 -872966361 -860088856 -845755970 -836276418 -834832896 -832706450 -815659655 -806573928 -789258810 -788412517 -746652739 -746539696 -742170989 -704008216 -691042737 -676512685 -651379303 -645829495 -634914959 -610874843 -592839358 -555814160 -538203954 -519293440 -500553707 -499448882 -446035041 -427408640 -417532422 -396966943 -371019938 -341088934 -335968470 -329172031 -323398015 -307345705 -288401396 -279232095 -278533731 -250749701 -228631842 -224901532 -214160746 -213483513 -201855827 -173003709 -157190241 -137577723 -131625305 -131557224 -114328139 -67693635 -53858616 -43954603 -40792587 -36911907 -33770110 -16607968 -7071740 13661925 21350794 22462406 30879195 43148401 57…
Output: 67

Example 3:

Input: 71 -417335117 -980478176 -890570668 -884063182 -879871627 -854612747 -841976760 -812877582 -798339502 -714856241 -620060625 -564958235 -526524526 -471379932 -402560128 -385684923 -368252772 -362998006 -348882559 -270515902 -267437641 -221215628 -201737922 -93155307 -88256285 -54221865 -17506341 -13420817 -40657 3855124 5623397 69501949 70242593 119957699 132156785 148215238 150370926 172544541 186381782 212058681 239187642 255519102 313678164 319301692 433010669 447513427 456379929 537247426 537502809 542689940 551719513 562750401 587042181 598884151 635185292 664011954 699707689 712024881 786513140 810275790 827137910 873626376 876122602 906324455 910635662 919292292 941248496 953389912 956534108 962539512 977123883 999152580
Output: 14

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Caramel vials of Rohan - EASY Coding Problem | CodeTikki