CT27916

Smith's shelves Reckoning

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

At the rook towers of Chessfield, Smith records each shelves in a worn leather ledger. The guild wants answers, not guesses. 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 <= 698; 0 <= a[i] <= 1000000000.

Example 1:

Input: 325 216 34370197 369002207 104972526 293061339 286506229 646363232 151195194 451378822 148633981 910297770 145820561 541516352 128472067 490365309 902264185 378932321 172837378 979898830 582484343 511207176 120012389 353075471 635820218 282290596 721623780 813799954 872703623 584426576 965360814 96546942 968813276 136002810 186214246 800834966 631058617 803155605 568884375 521749029 250724094 219874259 393755957 625282045 610452429 12782870 76969493 253013021 73546042 717867432 521143939 839623403 80347284 509633112 353609737 851532562 214354610 754495720 315218452 67279335 38243219 68060636 658082935 872520554 527492009 775681113 171502845 80801830 807728922 339203984 31969447 963732766 19543052 213576365 218075913 842893012 914523781 721292144 605406036 655240191 592749170 512810839 1090…
Output: 290453109

Example 2:

Input: 501 349 118972629 893565644 65377972 398508181 262730739 630093750 221134326 324299136 157402696 703749058 485244743 21164486 634970480 581000123 224256336 22078060 332878577 283340 854784984 790546842 586043165 649209875 944958218 895964884 549344902 965210408 120147822 497092447 202720526 983491804 280368763 556301577 442284058 969833570 553544472 723276750 58715227 930706277 525990556 291130701 878564613 583407684 325718289 6829215 667682166 386212094 113136148 964051659 80857957 35527846 788702685 129553938 245944333 616459260 746782052 989369700 937079205 52516765 562682966 193833734 964179218 379732241 607238510 21454958 881974960 219638297 990960257 624865315 352369033 79376163 390790422 381294783 906258605 437580752 404517013 386856988 769727490 448675145 513902529 128910441 699071…
Output: 292702691

Example 3:

Input: 348 317 58291221 865540399 352276241 274950858 171724922 585348684 82797850 534762518 57417911 877401313 822311770 497777215 350228066 940418100 224002494 258829611 687738207 815158695 801090437 45390651 727358296 136806417 905767288 801422539 793685670 109123916 624348684 442772474 632959388 782167908 480075193 596353654 679424939 627769607 324982668 29277827 324273171 813919920 775403738 125006673 589777361 550922709 610515059 844459909 84676155 310978416 302294022 302752870 467796130 207015700 221518392 820252855 451137933 742312301 690444367 243103354 188959808 391198013 932165694 267554421 864551654 606649995 81343415 811186579 861646420 625736192 943667713 395715979 69641815 567050241 976787045 971103965 853186033 712553270 634056161 596889807 621404252 891136856 284425370 249638779 …
Output: 105648245

Constraints:

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

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