CT22804

The K-th Peak of Lodebarrow

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Every season at the silver mines of Lodebarrow, someone must schedule the next expedition. This year the task falls to Nila, 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 <= 435; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 233 86 -853667 23288 -279974 882502 548221 616203 -509813 -89414 -189890 506649 105065 63392 -307797 -913668 83303 448537 508904 -605679 577000 -489777 -293347 105054 752365 300763 477166 857275 -361750 305858 913134 -886239 -698039 -235371 382152 756515 -555769 -66231 -361823 -977870 972809 -350975 -782761 367531 251382 -967240 191394 994672 448937 400503 386268 -803975 216425 -404148 -164587 298305 218089 791586 828104 -773930 664376 -327883 -374423 751686 464307 -113784 -364370 -103145 -561671 -500609 -208886 637645 818322 612728 -720188 -333866 50439 -569333 914249 507089 -789431 -238983 559736 -67721 -229670 881217 -906373 -15162 -403415 -203397 134448 175719 -78952 -364717 787825 99691 409678 -830421 -855352 926856 -401480 -814740 910844 192396 464718 -466935 655196 639808 -716192 -2…
Output: 327919

Example 2:

Input: 285 73 880362 -917005 578787 988975 466304 686381 -484011 128627 -489773 -747038 -729127 758822 931071 580750 15545 -459022 -555614 -288918 -463363 -931305 -411753 -69936 923643 -389931 -645527 532561 266940 846795 496282 -837740 334943 796640 7715 -133819 137248 -130423 -109403 521579 871379 135560 -172635 496434 -33150 828006 -881897 -482065 466354 -369302 -63921 571038 -787027 -114547 -704361 311620 848762 -425075 -802936 267870 313136 -729270 -906276 725979 -518951 -20131 -661908 108046 -634694 449205 -500038 -861290 -901666 -214811 106844 479867 197030 448901 921677 719522 -89668 -987363 203449 648867 -848884 -464916 -388636 995085 63689 -75665 -381949 -495418 -662536 -365166 993532 558238 232086 -986718 341350 -871588 -974727 -84489 -311168 709123 727861 -474766 323499 483435 -807556…
Output: 496434

Example 3:

Input: 55 36 -177558 -266073 -565398 -184814 730604 150070 -732220 211458 -313406 -558133 -942340 284918 794955 -720378 -162267 425779 -856359 459361 -443296 814803 207420 445285 374634 884323 -140832 -271988 856957 15429 -615034 -902327 785487 698186 931943 -380593 512871 468472 95281 -997246 -521745 430574 -903258 712094 350499 703233 -57689 -559550 -374963 343391 508843 717032 -444789 379309 590995 801721 352400
Output: -184814

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The K-th Peak of Lodebarrow - EASY Coding Problem | CodeTikki