CT23566

The Sable K-th Peak

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

It is audit day at the ribbon falls of Cascade Vale. Porter spreads the crates 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 <= 373; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 243 208 771937573 89471450 790303611 106706492 870324581 500567321 197670584 691407145 135419701 456812926 548330240 478068572 92537807 408930023 592868569 865025299 940500678 780746463 264632611 815555194 163185203 570704951 244190123 90196279 80036284 186564495 267425991 137415183 812458074 582679873 597956881 584385636 981964023 10287037 490609851 891660209 861869159 151905551 228940297 361885456 267952725 248180979 324895687 571637730 895053968 636923224 297675828 549366757 831278901 726509817 12542247 901628675 520149834 152447658 774571524 445039133 12961291 868481819 909307732 966217758 985805249 392065871 288683676 177281371 745767941 596938291 12528613 577741562 520988221 290346635 829029598 762285793 621363645 420952091 245749759 997768969 177723192 584291548 56284847 895854343 3…
Output: 131784797

Example 2:

Input: 162 145 456271548 901581129 582103011 272177640 903614996 147867057 826803833 558563135 110414329 403920478 685394496 239967158 114025413 246201295 709471401 444910886 204882863 44735942 163828058 754039612 114150147 349349162 291916988 858785411 123048049 377564927 525774324 950693800 471527171 930858147 200479965 158773316 453667219 877085888 113123919 607687480 18316975 860311605 546649272 826572455 673818382 532405436 453506842 869464793 762204847 655953832 134062813 144673742 667358356 175503578 357343370 133684702 672788692 264311388 414531047 139719269 295124523 23998513 90718048 535417590 666748921 615408130 742648926 340478419 191554583 182233781 499639192 381737272 209396528 624658922 764720278 850662665 361979289 707456296 601372519 795432852 307586130 160105146 121391593 539818…
Output: 114682094

Example 3:

Input: 179 47 426418878 756808590 710048324 903558404 906912225 892961746 94708267 841615931 485544739 430893738 319623114 611947792 447780989 796310146 20673615 448394104 674932916 594789938 319315814 147320585 790146258 731963208 814309896 500526591 477245209 410626204 900729630 708031863 817464516 36177688 15097459 786507352 663705793 874533597 358612086 662144822 955704989 548090596 278383211 482284477 268671313 518852667 47956144 78287441 926174989 262991411 199620608 444999604 361421906 749190922 374429579 544196631 425429648 628674204 10870828 901743878 402219829 877625327 801468960 594389697 235224869 335850866 343490509 115746077 211042904 173817403 913348466 812174785 351783835 567123027 556644493 736069184 326312000 574135535 456889369 862680811 400521814 887486499 570928133 547967652 …
Output: 766827395

Constraints:

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

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