CT28521

The K-th Mark of the Opal weights

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Deep in the salt flats of Palemere, Dev studies rows of weights entries. One clean number will settle the guild's oldest argument. 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 <= 272; 0 <= a[i] <= 1000000000.

Example 1:

Input: 33 16 985483913 210084243 479544226 601768884 694487507 881944417 229988918 485986569 607311934 277855140 334052829 26604292 180620520 878258269 922759320 248483386 409766756 534570252 953961989 865631367 823519617 649307314 683635300 580201638 829713034 664990958 993926005 563057221 220888346 572158822 835010988 354732784 280975948
Output: 572158822

Example 2:

Input: 23 15 954000568 337895963 144887439 797823152 525409104 566452775 164604217 673664237 985949124 798792483 531836404 135484641 637358289 736564730 282163115 894133678 97314243 132360181 569194342 262971050 997508892 101461805 821912108
Output: 673664237

Example 3:

Input: 212 198 396862378 524289628 818733442 424058743 193187011 411866341 417038568 382624085 435703853 385276137 359306102 612277707 209574639 532083439 839039739 265129920 581067018 582588718 963104369 602850712 196032432 531749221 17618673 775559511 458675513 932058820 681920636 324205836 827980452 520808168 742866960 359575267 622329566 619638594 755698238 380653453 507643846 697891590 37277206 139258243 856329190 89404123 508840458 344704230 133852169 603570242 614170916 396790906 372057654 350748810 532300176 123171407 680101163 505061115 50429831 539813811 272116585 260045082 71912465 731860808 14318169 861242585 209918687 796629023 417026408 543188036 41017708 825451705 505104455 287682251 277218859 958710839 159048724 203266171 865343471 496511139 313948922 319916552 655716264 96822624 …
Output: 883500573

Constraints:

1 <= k <= n <= 272; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.