CT29807

The K-th Mark of the Roving registers

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Every season at the ember dunes of Ashfall, someone must prove the quality of the harvest. This year the task falls to Gautam, armed only with the registers register. Task: Print the k-th smallest element (1-based; duplicates count separately). Input format: First line: n and k. Second line: n integers. Output format: Print the k-th smallest value. Constraints: 1 <= k <= n <= 7700; 0 <= a[i] <= 1000.

Example 1:

Input: 6858 411 909 980 277 835 278 917 75 728 39 722 862 748 287 710 195 190 655 893 478 746 936 430 708 394 478 255 239 217 676 151 845 597 733 594 601 78 569 131 652 972 256 19 504 658 905 565 326 683 204 162 757 742 217 520 397 854 336 946 659 430 244 743 636 209 265 277 765 716 5 299 409 68 996 486 979 235 595 385 624 785 580 459 474 98 889 547 620 382 42 711 825 230 371 406 511 502 235 530 474 709 812 963 350 307 716 319 618 590 143 772 599 218 60 203 370 219 930 326 793 511 996 570 727 921 570 994 922 510 590 789 744 588 157 986 403 918 405 494 484 821 303 273 454 957 576 96 270 754 30 778 403 305 348 99 237 729 991 621 614 327 307 366 11 991 826 951 423 189 246 125 883 989 89 323 97 92 519 430 742 164 740 87 379 712 393 192 234 307 275 818 701 109 216 263 973 594 216 2 217 382 642 669 127…
Output: 60

Example 2:

Input: 838 60 776 720 946 795 139 539 648 289 131 70 62 419 374 189 63 22 997 890 450 614 864 943 397 61 308 212 382 569 239 111 732 873 602 399 385 641 534 958 502 575 110 225 950 590 453 202 449 341 916 926 366 265 939 67 209 508 794 667 699 440 651 671 608 577 193 706 640 562 753 161 875 812 169 913 866 950 302 194 862 258 181 880 82 239 461 542 639 685 831 671 873 133 519 761 963 132 989 762 76 306 993 311 841 162 585 615 807 508 276 764 742 351 548 165 598 181 823 330 741 746 626 448 496 35 77 975 958 38 573 656 924 987 188 151 372 115 163 97 303 319 795 86 546 79 53 827 601 588 534 690 815 8 401 188 516 927 666 231 181 444 322 733 359 181 948 219 204 959 802 424 553 554 64 155 561 606 222 555 567 50 191 499 523 770 480 850 788 172 774 72 357 243 363 386 863 365 477 396 403 783 124 980 839 6…
Output: 88

Example 3:

Input: 6379 543 846 495 312 823 780 516 440 416 194 30 448 163 896 491 457 237 177 131 408 131 465 285 287 82 746 298 275 766 489 313 25 720 129 145 211 432 298 138 946 651 357 521 664 907 524 791 237 151 282 525 478 446 173 826 744 212 663 306 925 839 442 315 902 995 913 919 906 2 354 287 212 603 864 671 469 914 90 731 78 958 668 166 970 944 39 651 37 123 444 522 332 483 461 272 416 167 357 864 858 339 225 251 270 919 814 880 38 267 227 421 138 920 523 12 416 904 781 685 199 326 153 691 210 405 936 117 666 994 769 595 878 157 913 118 653 383 75 386 108 807 185 115 452 34 223 597 217 96 758 539 863 17 151 500 182 131 239 581 903 304 683 56 239 970 902 581 812 556 2 842 649 690 358 1 215 378 238 280 902 803 675 746 536 144 529 351 747 835 673 334 360 252 842 822 777 636 46 285 251 909 16 17 79 987…
Output: 80

Constraints:

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

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