CT26414

The vials at Amberfield

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

It is audit day at the wheat plains of Amberfield. Cora spreads the vials records across the table and picks up a sharp pencil. 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 <= 601; 0 <= a[i] <= 1000000000.

Example 1:

Input: 592 99 147178327 677396209 363776283 806760659 536862656 660575853 802268436 662202800 144618373 267595032 401514865 927659720 163096429 125819601 47509364 26055276 322443187 399555490 745504182 596365003 976017299 256245545 226999832 953727227 427967523 920730253 773513004 945619771 773626080 924002421 309865173 887133939 515950291 98434609 704207226 944716051 232090986 565297621 5190484 21520737 73739813 748566430 577753310 811722703 212147828 944521913 60961570 886517819 892714457 668797412 336957052 818162500 267468262 534595207 430261576 677715342 143718465 608638387 519338883 443345661 258788641 820454312 63019747 457736512 630376548 4281021 640943148 523655422 279515820 376511055 962603409 915407912 454407511 989922249 704598375 899165776 906641222 117342044 934835396 302072028 6130…
Output: 839123726

Example 2:

Input: 151 86 101287945 509493305 964560732 592595732 421511603 518030546 315886904 418975432 657292247 56628726 690615260 463832279 357378428 705026885 828062885 519201488 973886793 657482746 801185427 982810030 239323278 458367336 600245023 680701925 758394983 925022787 46658076 5550416 730395738 147582455 803859674 501465079 864925602 728386726 627042247 488527424 856583515 851070708 193770225 870175414 786272491 505710956 955150826 476073219 478515390 723465451 738722027 721751291 863258851 77943791 530454388 304490490 245008010 817899635 334412194 83972755 564833498 485456657 912178793 361195908 72027992 364678988 573375252 294619275 823845736 909450463 800741542 949048076 629956138 509101630 65129118 729365867 800347832 678016330 873454933 97035727 328710177 169028234 999784997 395755047 17…
Output: 476073219

Example 3:

Input: 225 215 834476662 322290261 894238243 948041868 829302070 648301368 63940632 92317513 93859707 390707863 574654378 246902489 964417351 222436248 111632499 452449484 458030508 322817949 125241898 891824629 641689592 579068133 103908794 449009241 794255913 339065604 801483665 932381902 962992933 474508650 921730967 226869876 203874237 575749577 468073989 346220099 970886668 757495939 671296333 646424888 554441185 698133934 216136553 669757068 530480346 600377231 724577671 662761824 222501396 162501112 37727830 28343280 350289603 969945452 578625178 805037328 508687857 888553140 567198607 224353649 833940762 236047462 591383385 463585553 439081865 610369512 434104797 995440620 94975285 805083928 472689219 797319599 213494880 288979876 83758228 960165004 747305229 411111222 419258446 329567086…
Output: 37727830

Constraints:

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

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