CT33253

Sara and the K-th Mark

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Sara found an old ledger of shelves in the customs house attic at the frontier camp of Duskwood. The margin notes pose a precise question. 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 <= 6348; 0 <= a[i] <= 1000000.

Example 1:

Input: 2887 331 38627 26293 197338 461970 762614 170716 228428 374 474676 349987 531442 791135 297339 939909 355382 934012 790304 11117 632092 607093 61625 613146 644561 319724 630475 463071 566141 453495 731628 649365 403693 984940 539051 971690 822125 331572 774407 997723 39393 73293 446354 629107 84941 965925 619453 411327 227045 109494 716959 407117 174010 445063 907227 333131 972147 154086 84445 100216 684024 351312 331247 720621 810931 86292 351266 382908 562970 687453 74531 506010 247900 639160 161487 722070 758652 477518 564206 346387 340511 503773 886657 14451 805572 883983 697998 163546 588656 278242 929943 531337 710635 743505 224399 520834 563071 937337 756918 100194 597460 813056 571242 680277 753745 960506 766112 13441 153795 914187 87959 990973 161916 21543 299321 233233 754596 509…
Output: 119320

Example 2:

Input: 5331 5215 3300 499557 286722 352282 470331 317509 155515 503538 539254 579258 894851 249610 914596 954368 548620 654894 734508 830624 118597 188334 867697 842066 607269 977541 332891 937521 826304 767472 485211 661622 185557 289458 945256 897171 825860 928742 338122 864753 662014 814765 657887 307687 143603 893020 536697 298980 277432 786564 432497 932757 446444 905578 30421 791760 442956 275313 29189 979780 805504 519161 118208 207336 485833 189787 52139 156561 995138 384687 358235 894770 135121 75460 91214 887115 615444 644569 436544 588306 283665 652464 585022 896530 615485 530414 713449 808517 468495 994464 361058 342817 176886 715834 275000 762828 48673 671930 380007 214162 360114 714978 908758 367833 584378 205075 627002 202923 773731 34292 661667 369449 748601 428381 742233 420989 7…
Output: 981587

Example 3:

Input: 6142 5255 545611 585420 695286 341664 733293 451401 344040 776979 450076 277214 308765 192396 317372 961694 769774 269584 753684 858647 246686 95714 437083 698265 621642 230742 341283 152203 124729 918440 33998 619726 828305 674590 481140 12521 470285 521428 550849 12286 154665 336528 738320 895807 870969 854223 189476 820269 664035 282792 969604 762904 516904 514792 280470 224278 14852 257900 325856 844450 864228 199884 194173 478758 174638 760034 763770 464777 660883 434100 14378 284228 700173 294489 423708 741891 875054 107339 496035 980462 841421 171836 371792 135963 398094 503045 880113 406574 18060 709876 779195 506185 125833 813897 184234 222787 867591 937051 956379 543570 931606 841031 120883 501217 693415 684974 426426 267540 619151 751389 244293 514732 806254 737694 408511 957208…
Output: 852129

Constraints:

1 <= k <= n <= 6348; 0 <= a[i] <= 1000000.

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