CT24119

The crates at Whitesnow

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the tundra station of Whitesnow; Cressida 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 <= 323; -1000000 <= a[i] <= 1000.

Example 1:

Input: 173 112 -116865 -167509 -536665 -268639 -185325 -426974 -549614 -631912 -178079 -847930 -227207 -160795 -878609 -506823 -712111 -633042 -773616 -458680 -897242 -899010 -28269 -692897 -170485 -237027 -106767 -440116 -875285 -787786 -390714 -100487 -810872 -865425 -565555 -76539 -350626 -986147 -999398 -363584 -224429 -719094 -836383 -677158 -855580 -98539 -524625 -797483 -918940 -710725 -485370 -576933 -141943 -388551 -468824 -706444 -971326 -952409 -92398 -709160 -154480 -965625 -280928 -207834 -884341 -1993 -425094 -616086 -806273 -977246 -12605 -769851 -616783 -403608 -751478 -802089 -732338 -847561 -88792 -188527 -833525 -488339 -837940 -584554 -272565 -82460 -651573 -1579 -923862 -485446 -454415 -88622 -820402 -584655 -346322 -359109 -908029 -265189 -813291 -625990 -483016 -236621 -770…
Output: -425094

Example 2:

Input: 27 16 -858512 -797115 -972081 -475059 -140556 -956072 -775476 -282048 -600641 -917322 -654979 -666750 -964962 -426494 -633123 -199759 -512574 -317352 -267703 -286926 -543083 -74335 -704594 -689067 -157362 -742570 -359528
Output: -512574

Example 3:

Input: 90 6 -228125 -400282 -560361 -105122 -142427 -773303 -278660 -155027 -490291 -975061 -239561 -891747 -806650 -742696 -652727 -842986 -338187 -272112 -623883 -792842 -290008 -11304 -403756 -262035 -121440 -195800 -239060 -952418 -359563 -700127 -990675 -421719 -895965 -95840 -52917 -495767 -111383 -186425 -438973 -219227 -364327 -747373 -815496 -376353 -821089 -858886 -879681 -433933 -945332 -263238 -8762 -108053 -132166 -352160 -166849 -92600 -213063 -785032 -279415 -857009 -915076 -76843 -871893 -968647 -979753 -455119 -250092 -925017 -434859 -596178 -225196 -378907 -146946 -440771 -980646 -360909 -912603 -806813 -151400 -260873 -374069 -375279 -12801 -252145 -347182 -626241 -830299 -105408 -990284 -694313
Output: -968647

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The crates at Whitesnow - EASY Coding Problem | CodeTikki