CT26317

The Silverfin K-th Mark

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Clerk inherited the foundry at the herring shoals of Silverfin along with its curious bookkeeping system for crates. Time to make sense of it. 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 <= 259; -1000000 <= a[i] <= 1000.

Example 1:

Input: 7 1 -374155 -92294 -633410 -656356 -691703 -541800 -904222
Output: -904222

Example 2:

Input: 41 27 -320163 -966034 -800769 -344228 -640285 -249570 -757832 -98917 -9758 -446884 -392679 -553211 -618115 -37065 -182877 -97564 -784024 -905979 -867974 -777719 -317113 -725918 -534317 -828444 -880883 -300084 -240149 -9000 -951984 -665688 -897189 -500571 -873504 -955182 -52924 -295322 -856487 -439783 -39974 -838076 -681096
Output: -344228

Example 3:

Input: 45 33 -747986 -895785 -674885 -83015 -125316 -826148 -971885 -191798 -100092 -925886 -415067 -285337 -930760 -265309 -360770 -346733 -914981 -229616 -343192 -561142 -580129 -938770 -126296 -370562 -170195 -103627 -654786 -153898 -383982 -417888 -43644 -717148 -577199 -734518 -68740 -711842 -471320 -677712 -621810 -217804 -105982 -175129 -6684 -795145 -165394
Output: -175129

Constraints:

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

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