CT27263

The Rootwater K-th Mark

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Tinker found an old ledger of registers in the gallery attic at the mangrove channels of Rootwater. The margin notes pose a precise question. Task: Print the k-th smallest element (1-based; duplicates count separately). Input format: First line: n and k. Second line: n integers. Output format: Print the k-th smallest value. Constraints: 1 <= k <= n <= 909; -1000000000 <= a[i] <= 1000000000.

Example 1:

Input: 104 85 -54289863 -561420092 -259645561 -654964496 -861663588 518625032 -699861160 -632065225 -998599156 -42467357 753036784 -676943749 -284608691 176055251 -280895482 -873867822 -787766265 -959747545 32087187 -15551231 -740286092 -768486674 -673119865 335264752 -407065921 583139062 -436326294 -747689732 142760450 527525671 864995104 -417448636 -631185588 -894689041 303634575 923253219 -836906408 -921074067 -287296452 -374950915 358394465 -771418741 498917837 736795238 738380739 -670508185 542138967 190694307 475099707 450936822 902817340 -130187915 -606393112 204542749 -637576693 -83398802 -699355452 970785242 673550539 -849089411 742821414 93935273 -899641834 -909110511 998921195 42192910 -952448541 346929028 -73281063 765456138 -639547230 -139501913 303384576 506615125 -208467649 7437463…
Output: 583139062

Example 2:

Input: 508 133 816184586 650738303 689596611 654544502 -833914765 -648297950 492052801 44969379 904455629 821792950 -731219648 61346593 527499068 610149220 905914131 -186511646 -414247622 -355822529 300051028 -564594381 9323460 -57158622 941681524 -5840982 905162855 252765237 229540982 -918505165 659467308 213522089 -47076098 -203694232 559838124 -749429944 126332195 925460262 522955822 -620046602 652144119 -775478931 -138639265 -897761778 348778270 -756809827 -156065741 381719725 -398982003 551860281 -449971275 -975106159 -191815236 432150132 885377484 -156092476 -795024919 581887816 -520316529 -628932429 -3779344 870253848 -901769201 389910135 -312233197 -750087175 193162159 -297209852 -207396987 551665024 806953670 -356004886 -476578854 153367366 486169620 -348984654 985801411 -174388941 25783…
Output: -446935097

Example 3:

Input: 595 562 703558197 416537989 -76061599 303864768 -193051912 -933838594 427418379 64949732 682672333 849235463 -255261335 969173414 237167316 860321366 833317356 342692379 -4256195 -728784308 211215323 958285066 -24543112 102507767 710212489 -563786402 800971409 543903061 332854803 854183462 426065722 -539446355 828847656 -362156196 -849190404 -638841955 298681838 -821479869 710483155 -891082393 504686949 206585473 915315052 -708919327 610841383 -120776797 982903509 295277934 -740845626 -731488341 -570206394 -275532583 -939454614 -112423783 803368870 763111072 -265478968 2697535 -920306293 134741494 -936755536 476011804 187920936 785381192 -502737025 -188395472 -48743329 -521421635 470494033 627512246 -74943978 -995774258 897682406 -539872993 974254978 -102995333 -4666073 -886107088 -5044555…
Output: 884024066

Constraints:

1 <= k <= n <= 909; -1000000000 <= a[i] <= 1000000000.

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