CT24334

The K-th Mark of Serpentis

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the jade shrine of Serpentis; Vigo weighs the day's weights 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 <= 374; -1000000 <= a[i] <= 1000.

Example 1:

Input: 155 85 -604712 -9024 -257432 -727674 -875441 -875205 -561485 -372476 -963657 -36991 -68595 -910393 -517140 -785176 -601105 -874371 -437884 -378679 -331080 -741731 -601515 -674488 -437747 -286109 -521202 -341255 -265677 -44936 -28796 -954168 -257767 -474594 -376457 -394656 -15597 -862691 -112335 -576712 -718947 -29422 -756421 -342953 -556257 -746882 -509882 -314615 -238075 -53430 -921439 -863859 -115681 -766585 -769497 -556330 -367735 -469742 -677743 -377344 -742024 -698345 -271729 -96811 -368078 -368047 -622701 -541985 -269972 -946844 -573962 -134500 -347902 -142633 -734052 -351534 -530043 -310788 -997275 -738730 -878234 -133100 -358821 -428198 -571614 -940295 -233199 -71477 -808829 -125964 -701182 -429028 -505892 -495178 -352661 -236831 -547707 -465959 -420040 -685479 -624714 -678868 -258752 -377764 -689491 -977396 -797137 -494662 -132180 -923494 -528223 -497553 -715409 -739571 -663806 -318044 -87763 -875849 -882468 -587807 -550760 -515552 -799464 -813347 -260225 -747368 -305845 -507109 -851817 -17066 -790385 -167108 -262612 -697558 -791590 -527509 -890309 -109468 -986210 -995049 -902100 -625001 -990370 -752397 -284437 -587047 -679851 -400986 -248773 -658034 -545370 -910851 -236603 -538473 -139215 -983289 -480518
Output: -505892

Example 2:

Input: 130 53 -951370 -458331 -107973 -610146 -110617 -445138 -301614 -314162 -640833 -936012 -561270 -370710 -119474 -842811 -562774 -169841 -650106 -183639 -788682 -956376 -929363 -147551 -744911 -317314 -895549 -303815 -855684 -628324 -387828 -851569 -780024 -676498 -427929 -244637 -121841 -633325 -317256 -897930 -483682 -339199 -397038 -102997 -667952 -599862 -861276 -989193 -223298 -892574 -78496 -66500 -586171 -607143 -268094 -6523 -295244 -482366 -437886 -925607 -975098 -584315 -448466 -695382 -27648 -907100 -73865 -401872 -652568 -848488 -63481 -388785 -61110 -471310 -451907 -952080 -444203 -109554 -462792 -226945 -869872 -432503 -958599 -722806 -271075 -803733 -63598 -313360 -963270 -73638 -727727 -683073 -355366 -291002 -132200 -443330 -869812 -207782 -680619 -28800 -77345 -754908 -275094 -304275 -394571 -813570 -352511 -805440 -492425 -401707 -976129 -289076 -422362 -58223 -581982 -792464 -741622 -986643 -302944 -84266 -623469 -155716 -863244 -442629 -325310 -648160 -518937 -147784 -281272 -692567 -354313 -254702
Output: -584315

Example 3:

Input: 188 56 -967231 -964897 -448610 -816590 -30671 -728082 -540929 -241616 -856109 -710315 -928687 -498301 -803877 -473850 -931611 -56192 -448575 -485675 -517812 -534326 -775686 -827553 -983328 -372175 -523158 -979458 -651141 -727554 -958635 -163682 -966580 -543420 -463574 -289019 -151199 -743212 -448312 -255928 -290501 -495170 -947575 -908082 -971096 -785125 -31726 -491458 -91127 -860177 -478843 -347185 -969466 -766665 -541559 -99273 -772559 -715952 -870415 -229414 -70615 -313061 -496546 -729532 -494734 -230883 -431973 -670358 -44398 -275759 -660705 -219181 -887751 -669269 -86037 -354481 -312389 -776611 -371068 -388436 -146520 -213403 -828460 -804047 -272227 -202243 -42497 -220804 -942087 -5115 -737634 -562472 -383733 -805108 -57813 -111525 -882439 -165833 -163993 -328803 -244377 -924898 -1789 -640628 -962860 -613805 -307243 -935166 -974126 -176144 -316546 -235341 -927048 -374592 -264152 -476571 -285027 -917503 -231888 -199916 -689340 -324995 -985230 -147839 -185562 -998949 -727930 -498712 -115227 -640657 -360121 -252451 -17330 -423629 -742752 -130748 -199676 -388004 -625776 -709877 -179300 -831353 -763859 -372586 -682069 -571073 -65260 -238007 -537620 -922804 -406057 -373346 -145419 -258529 -651137 -445164 -843520 -92372 -963412 -854103 -123531 -548167 -274068 -508448 -240429 -125883 -49168 -852534 -937932 -498752 -802369 -138725 -365749 -50268 -828013 -969225 -110598 -694914 -749469 -316217 -882507 -792251 -155466 -876886 -615846 -396547 -382386 -354977 -580874 -300877
Output: -729532

Constraints:

1 <= k <= n <= 374; -1000000 <= a[i] <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
The K-th Mark of Serpentis - EASY Coding Problem | CodeTikki