CT23257

The shelves at Saffronia

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

In the spice bazaar of Saffronia, Forester the ledger master keeps careful count of the shelves. assign crews to the morning shifts, every figure matters. 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 <= 711; 0 <= a[i] <= 1000.

Example 1:

Input: 32 24 105 296 65 63 107 556 420 677 888 573 79 74 633 714 212 131 836 996 859 235 52 199 842 763 742 764 819 96 678 969 507 80
Output: 107

Example 2:

Input: 435 141 276 407 820 907 110 614 390 633 552 190 755 425 763 153 954 625 922 38 725 445 910 132 178 579 828 61 699 394 858 679 590 54 152 847 116 846 782 728 994 728 97 445 341 241 712 453 178 478 400 791 214 915 74 438 695 674 493 604 67 950 387 649 902 193 284 370 3 125 827 581 559 680 344 538 778 532 893 268 704 765 161 743 126 932 308 618 488 830 991 787 658 229 297 834 378 407 641 886 122 284 593 524 540 610 369 893 785 921 269 525 355 993 928 853 456 250 804 89 9 855 737 547 764 522 165 541 626 554 487 179 415 319 189 685 198 705 162 143 910 960 858 605 774 984 288 699 898 478 628 445 813 572 860 187 310 827 242 136 292 523 768 370 69 876 74 485 402 581 419 22 373 611 905 124 316 462 26 161 473 908 840 578 327 769 79 60 644 2 95 449 38 452 356 977 536 404 640 73 678 562 630 76 199 313…
Output: 679

Example 3:

Input: 291 114 403 823 990 862 53 326 621 136 920 948 585 734 249 843 262 347 151 450 633 689 996 600 457 343 492 859 346 211 998 445 362 117 60 123 859 279 913 773 847 2 712 953 827 977 524 372 834 667 5 509 898 163 36 470 343 489 302 132 779 507 40 379 482 625 176 454 72 188 98 66 296 965 953 430 926 878 506 243 751 272 450 784 471 907 500 358 969 986 44 505 315 554 913 822 324 304 135 246 202 60 79 202 175 611 932 114 937 535 769 183 6 231 705 951 267 240 631 7 519 767 359 343 468 817 344 817 169 380 33 894 810 81 336 148 297 653 389 433 263 960 428 646 369 927 395 657 227 478 776 629 124 240 595 636 671 29 502 760 580 888 131 278 202 237 841 900 205 680 677 542 416 735 894 489 245 286 280 757 823 374 899 870 866 510 243 17 832 483 437 74 806 392 585 413 568 931 922 282 819 470 107 1 896 834 7…
Output: 542

Constraints:

1 <= k <= n <= 711; 0 <= a[i] <= 1000.

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