CT33608

The Ashen K-th Peak

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Every season at the sulphur springs of Brimstone, someone must verify the ledger before the auditors arrive. This year the task falls to Urmila, armed only with the crates register. Task: Print the k-th largest element (1-based; duplicates count separately). Input format: First line: n and k. Second line: n integers. Output format: Print the k-th largest value. Constraints: 1 <= k <= n <= 5495; 0 <= a[i] <= 1000000.

Example 1:

Input: 5330 5326 214924 797577 672229 813846 947797 464498 531716 405513 538887 792866 522875 294163 517298 858894 916465 976991 659731 646916 898933 693359 527238 170016 315261 973343 464743 71368 918748 292409 827944 499036 794220 694149 742728 535923 441491 460807 31486 912462 441420 981745 120300 331759 791372 331158 825453 364381 575209 284040 286600 360857 144583 705761 250418 204073 963997 62636 44770 970717 819427 3687 871925 660803 226646 230227 634084 480477 924696 190272 815508 934910 457216 961814 18756 910298 105628 300797 574802 377721 122971 947787 869123 301367 429352 801613 690737 71385 612698 678002 361765 143361 123704 316116 339369 327865 805729 848909 685890 75532 371615 327966 182443 455466 477473 967158 36181 923527 631341 206863 278798 434143 110569 629243 890624 30648 510…
Output: 863

Example 2:

Input: 1246 963 513904 739413 378628 494743 283635 827433 392208 741519 586994 868335 609471 94468 418831 636682 146810 332823 847703 133261 100814 321651 164137 912384 938718 998574 30777 898550 618159 811912 460927 107122 860334 818033 78338 497535 542805 905088 971038 648028 214694 529446 707056 773952 142449 139243 132909 93012 167805 251963 277216 802478 511710 769160 298627 506987 754235 341527 779566 44206 990731 924499 14317 82782 866316 552064 306429 532324 603941 839387 51610 634700 337350 539712 729449 314613 872551 74953 997435 336469 368104 129578 760988 92907 361203 821592 461493 271912 509981 401371 402716 264861 695590 639126 58067 274127 372028 722969 189773 667719 364936 167729 863012 973380 942936 43927 725608 231579 908249 113113 151907 187280 888797 633435 350127 214752 56608…
Output: 220353

Example 3:

Input: 1226 84 553999 33811 434486 736210 276337 678892 79338 299968 335015 805647 918447 471971 664246 665350 127198 140056 153522 850090 530560 103505 445987 890606 27519 262370 744381 203035 498928 871731 354333 474390 828701 56435 639135 822467 273998 615175 308569 748798 914786 612604 132443 445790 571319 811601 990168 559468 668568 411921 593751 312981 32829 216786 131371 787714 256279 786578 188207 568221 285965 944035 217577 664568 39567 129981 194401 852319 557000 551433 868449 182783 84455 34325 378353 796128 686488 832674 669509 662300 439295 684082 396630 387385 237046 229902 444710 452523 829173 564931 833999 174865 544137 901819 171472 583920 275964 838537 321356 902137 49984 707093 51281 701935 407770 409412 661661 787250 540204 446241 559967 61723 194152 72809 39121 51556 330117 4…
Output: 924813

Constraints:

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

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