CT26100

The Jasper ledgers of Odin

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Odin the chronicler watches over the island market of Coralcove's stores of ledgers. 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 <= 451; -1000000000 <= a[i],x <= 1000000000.

Example 1:

Input: 41 672487209 -994712523 -944425699 -940142285 -905644989 -849544659 -848218379 -815092610 -789813745 -686921874 -679959742 -566809788 -486958359 -472193512 -422237645 -414652703 -329723845 -196338965 -141168807 -120248220 6066641 42196991 49848338 79712103 79970353 122939027 281697618 305229464 340668219 373288667 388453082 407763591 541847948 568143913 698361325 709962757 741720253 796619635 846219555 925447913 957887468 988108005
Output: 34

Example 2:

Input: 55 628677528 -984580177 -983306581 -909298212 -893275787 -880503966 -876793924 -845346185 -824542011 -727492864 -721535326 -721245062 -659816134 -647274943 -571661607 -530777219 -498645625 -450625051 -395061810 -387464747 -374670969 -356332388 -229721055 -171087371 -132582422 -83630897 -81229549 67854874 119209863 161206849 191267372 260608957 268534759 301129115 310096942 323496217 323630182 339954925 340446468 380446960 429676699 489889682 512457483 534179473 560922301 569741993 589092221 631019617 650187587 774036705 788177055 791918299 838812889 895638220 950131443 970408522
Output: 47

Example 3:

Input: 320 -226850923 -985582850 -982337096 -977676751 -972098722 -967922132 -961835664 -961213452 -946304273 -933715420 -933675443 -933159246 -930660297 -926266476 -918561005 -910191744 -894613247 -888857699 -882821207 -876330911 -873035315 -871442271 -870929354 -860648968 -854481713 -851164575 -842213465 -825720581 -808326803 -805259134 -800464068 -792273501 -782143029 -781987801 -770391843 -769661676 -743090065 -740974464 -739225692 -714925739 -712152702 -711150777 -707422140 -694916756 -694749790 -686745676 -679910625 -664757873 -662681797 -641989068 -630546973 -626944967 -606375041 -604844470 -601212190 -581494522 -580654890 -577748473 -569703628 -565623320 -560113588 -527650329 -523964209 -496985488 -494489486 -489981548 -484157411 -479265206 -464970110 -457066215 -428366977 -427388965 -423779528 -422795788 -415451803 -415113213 -409999798 -392568740 -390841995 -388215101 -381862445 -376803194 -369194821 -366397168 -351412424 -345010921 -338455929 -330262189 -329572462 -326008235 -320246269 -318059831 -314960145 -309088196 -308926094 -302889195 -291856298 -283581913 -283048567 -282890044 -267828676 -267798039 -266609887 -262040902 -261955658 -245302856 -243744586 -223358423 -215296275 -202840656 -202030567 -192220211 -188193946 -144037515 -142310835 -134724084 -133232726 -118655278 -117448017 -109522667 -109325922 -109093439 -108821704 -107929690 -96824086 -93648673 -82953776 -81710931 -78899261 -77512259 -63082656 -52282625 -47681523 -43927571 -43162910 -42499415 -31997159 -30403989 -29348217 -26374444 -23257478 -18202661 -12182527 -4279034 -144633 2416118 3662444 6989357 13063816 18042438 25556054 28434804 34305270 36430058 39830963 52281888 54709735 56455507 60250932 74783816 74977965 77483147 80365957 81366324 83502190 88484083 99310535 107909265 109447514 109973181 114831716 131580466 150921502 155925549 159865947 160374641 161644867 176991407 178201378 192459646 198432087 212940097 213910637 233969106 239637637 243181361 244375886 245032255 250838176 252345729 252754477 257100746 257112993 260365196 260888450 266042466 267043044 270961697 272547824 273229071 283225896 284220177 292528437 298968933 308110339 309582539 319703749 335839746 338290272 342636469 344529115 344952409 347346815 352213512 355647621 362822856 375057720 378378652 386239488 388027903 400700246 407212305 408603503 412611438 421734017 446340642 447504572 449869496 449947835 462723293 476492342 491717259 493783445 501718976 521385187 544419042 558751760 564222184 564434554 565186584 570859467 576000512 599645842 603477968 604978886 646006374 646591598 658809322 661968041 674644122 679961136 683443591 689593494 691136679 696630915 703061199 704345793 710384897 712199474 718695429 724286036 740744152 743190923 749355160 765777379 768542071 769823377 770611270 779185749 779903207 783204385 789756833 800083895 802835022 807946993 808741850 810738189 814646039 816023546 819905119 821301283 831932895 836326568 838551024 840102455 847556592 847618647 852653761 858612922 859841555 860613930 860881437 863287212 867940487 870925129 879317423 882277175 883626334 887331417 889062968 892492203 905564985 908944354 909094492 917997870 922652217 923602902 924113712 939539051 942382434 947295431 951787385 956117440 964778342 965697885 976192554 987106139 987480063 989145858 993064620 995080595
Output: 107

Constraints:

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

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