CT22584

Captain's crates K-th Mark

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the saffron fields of Marigold Row; Captain weighs the day's crates manifests and starts the calculations. 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 <= 365; -1000000000 <= a[i] <= 1000000.

Example 1:

Input: 165 129 -735477032 -784400728 -106531078 -692667004 -18384435 -811860513 -837187134 -171456886 -696745911 -691253880 -616626413 -298359745 -13445428 -321033213 -57084431 -291315982 -487012075 -470953078 -208801066 -800492829 -589653535 -590864496 -332614323 -827791455 -462208414 -767450966 -583341140 -939938441 -957678268 -916891893 -225387240 -224483731 -8798930 -778070229 -540263594 -355056815 -801424521 -989541798 -349278907 -970099075 -242827005 -537787968 -145352733 -277353280 -499547652 -860553195 -948630167 -263765778 -902150918 -42103224 -423416373 -147456596 -863169125 -817454418 -683981827 -388015178 -278992604 -948576776 -704596335 -255869244 -344963698 -544500618 -838154055 -567940455 -282497888 -829875096 -820654931 -488050706 -666764357 -128355840 -931990092 -236394381 -74431…
Output: -240497261

Example 2:

Input: 278 223 -431258376 -866022634 -522912904 -128659651 -699352834 -219595032 -723251066 -970862089 -341167975 -298584106 -141864319 -921086521 -217214531 -535340229 -76083874 -905376156 -616410595 -3651045 -191525594 -115334293 -521481173 -28222204 -172282878 -111647399 -217872326 -741060980 -333651939 -596024244 -737549920 -247254766 -128117430 -679276270 -463366836 -917647765 -410605573 -503677254 -790252557 -269411241 -59215797 -741949011 -564224088 -533689035 -82622102 -828062320 -899557071 -819541521 -318806996 -470370036 -864530418 -703065473 -787538690 -910723785 -63462634 -301068974 -822840739 -732637360 -442534846 -305703239 -585948302 -112528698 -673908440 -44356654 -195662837 -623657808 -510744622 -376799613 -427041047 -282958558 -784444239 -968746897 -488806419 -458724050 -7555722…
Output: -201939344

Example 3:

Input: 231 33 -29355396 -961668522 -889277318 -985925349 -66019398 -764173861 -913395650 -413887577 -965483028 -763092917 -956458569 -703870454 -740825489 -226873258 -850533095 -803794081 -264122424 -426187598 -223284304 -208699411 -321562076 -922183397 -67556760 -859941127 -373988503 -355367352 -354984425 -140196455 -101542243 -883480949 -392324456 -384158779 -101017751 -687413846 -589977855 -696312624 -756210059 -794918094 -952366870 -880565206 -720085905 -940657154 -256804529 -411436154 -402900190 -580700556 -222475366 -418731098 -616303791 -664152318 -649550929 -71671889 -454116263 -686779917 -446579179 -272039396 -498984579 -718394398 -510330921 -941862705 -296120154 -893445441 -858223444 -292704498 -403462927 -176394022 -614178183 -802408712 -828116146 -511665658 -626412545 -102748205 -4045…
Output: -859941127

Constraints:

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

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