CT27994

Gardener's Caramel Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the fox den of Rustwood with crates of ledgers, and Gardener the accountant must account for every last one. 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 <= 432; -1000000000 <= a[i] <= 1000000.

Example 1:

Input: 427 215 -953310304 -116585225 -850078423 -357441711 -487837808 -82975199 -648889718 -329695107 -481917304 -334517397 -372618802 -441212430 -77721867 -433540782 -372968392 -362207559 -521951638 -49098857 -382130720 -215983289 -161583093 -977126367 -566849690 -737210781 -292517583 -377964634 -781281104 -378048175 -199761014 -175807164 -591859845 -721311470 -518091534 -373538819 -891655054 -850786972 -407936990 -427396456 -708861772 -964031160 -826664640 -615077028 -752970677 -429548257 -529507316 -953236081 -654959423 -454239958 -185897435 -848818559 -594071969 -432882581 -919080991 -176866947 -401775910 -355393734 -232993078 -267716032 -140370156 -991030276 -275287751 -550618652 -307012169 -98771791 -168675337 -57105402 -827384618 -761736513 -932113406 -469114831 -887737406 -536112524 -8852…
Output: -476546503

Example 2:

Input: 427 164 -827779013 -295547120 -529683701 -413386120 -109311641 -95861366 -588229774 -964692882 -299466856 -908547193 -422108886 -519207469 -556049737 -807945594 -649086803 -800193994 -335238749 -763341252 -514505540 -669166735 -500771589 -285178022 -991502850 -47061441 -732528994 -566919295 -929483645 -681013561 -899492859 -758307297 -776518182 -600450785 -499786433 -77479893 -52939737 -535080676 -31204289 -566057056 -109263760 -224514808 -744623499 -967983907 -798369201 -376223898 -978301447 -906674584 -593724070 -175169748 -599909285 -834537090 -223257282 -176462727 -762524010 -351613995 -125577204 -49183467 -500248544 -89583548 -914478102 -791448182 -526067878 -546001588 -313918985 -562315785 -582099817 -448984692 -973079436 -136234647 -277160595 -375692577 -821521610 -129503987 -534337…
Output: -649086803

Example 3:

Input: 425 246 -898135383 -94714165 -324971541 -866535602 -273692962 -213737984 -534083658 -763362791 -799354656 -168237377 -540857390 -703049109 -796121095 -527551541 -804582227 -529361460 -1505642 -698005368 -246007433 -403225332 -128263617 -245637517 -271403905 -57106425 -529573696 -546935018 -336794251 -854860107 -288619003 -357632367 -549262560 -321259657 -889451443 -945148517 -388693468 -517973140 -331749845 -981928420 -178112278 -869439808 -513733669 -575300031 -655044596 -558412983 -551500900 -556289794 -212398730 -899111588 -414160328 -694699620 -614109131 -432897266 -721670141 -486250086 -852609990 -519525748 -286188296 -652234757 -870793240 -322520885 -226185325 -673711054 -89345819 -430032549 -862617084 -249992509 -798705086 -734564635 -421178187 -283796835 -862511687 -628487547 -5561…
Output: -456960342

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Gardener's Caramel Ledger - EASY Coding Problem | CodeTikki