CT29274

The K-th Mark Beneath Amberplain

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the savanna camp of Amberplain. Uma spreads the registers records across the table and picks up a sharp pencil. 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 <= 6832; -1000000 <= a[i] <= 1000.

Example 1:

Input: 2275 993 -194525 -620007 -850602 -600233 -801788 -197111 -37596 -707480 -157275 -836349 -849012 -518151 -994314 -992612 -478689 -446594 -220982 -933833 -625780 -638376 -951345 -324172 -467990 -60025 -163300 -405483 -882365 -159297 -512670 -290500 -685210 -962418 -818953 -401282 -287016 -958963 -695604 -530403 -169774 -92332 -421769 -664774 -594529 -952771 -464246 -993273 -273156 -542414 -694315 -695510 -380538 -563857 -561316 -355072 -513813 -673821 -776706 -680977 -3286 -509344 -804701 -693354 -688482 -258054 -424044 -586244 -519275 -482305 -402833 -986115 -221976 -915211 -544025 -603077 -593381 -181527 -489222 -398006 -407782 -393580 -451878 -374812 -142928 -33335 -804813 -773339 -212000 -827861 -26125 -236819 -777259 -955637 -631845 -796161 -311923 -646673 -642578 -723014 -703753 -46855…
Output: -566621

Example 2:

Input: 6406 3326 -374656 -666554 -484842 -468807 -179347 -500129 -789014 -377976 -64737 -605426 -194151 -300282 -269867 -260030 -850502 -772549 -485400 -505878 -456579 -264774 -432082 -376296 -127293 -998212 -466369 -642901 -510167 -608447 -691924 -549533 -581113 -809013 -727557 -807817 -782506 -333271 -596118 -8234 -380750 -714276 -891625 -12652 -32055 -672646 -329893 -680615 -723818 -141762 -256121 -324136 -380255 -117057 -565579 -220105 -583114 -220415 -748601 -460129 -168009 -522875 -398406 -525711 -629883 -866776 -899033 -523389 -276714 -180719 -650816 -357844 -199439 -166757 -450624 -624512 -576787 -108210 -227701 -952652 -176989 -628595 -50094 -813953 -858480 -916628 -894697 -118006 -416564 -234744 -753171 -286953 -229970 -458106 -708676 -634324 -171389 -137492 -251752 -484892 -389206 -671…
Output: -474258

Example 3:

Input: 1656 1538 -185666 -314433 -678934 -631782 -709759 -456132 -320233 -827775 -857939 -670829 -951053 -433137 -854596 -505002 -256894 -885820 -458860 -690780 -544080 -62626 -426008 -556743 -385832 -753926 -948053 -278593 -277222 -107906 -951389 -191157 -507913 -153982 -150142 -56019 -699049 -958251 -914044 -741267 -109109 -114825 -820766 -955066 -781981 -942960 -326646 -458144 -549488 -108225 -517170 -133701 -930128 -932593 -562981 -14056 -905370 -118438 -507067 -416093 -453930 -529474 -335381 -84637 -133579 -765845 -858623 -695777 -287227 -175842 -417695 -712788 -621116 -502761 -327591 -400181 -429035 -22199 -519820 -231697 -665048 -757409 -618285 -420080 -910075 -446349 -582543 -374711 -271981 -232494 -478839 -289498 -652812 -86488 -153429 -956034 -549570 -32549 -143818 -196539 -919587 -1777…
Output: -81205

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The K-th Mark Beneath Amberplain - MEDIUM Coding Problem | CodeTikki