CT33500

Last weights of Quin

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the boar woods of Tuskmore pays by the answer, and Quin intends to earn it. First: the full register of weights. 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 <= 5216; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 3132 895 264629 205868 -964690 470639 -898457 611601 -813707 220390 185735 279646 -672821 24582 -188344 -942355 680600 -850862 128824 -833476 465645 183633 766788 738426 -718694 -866158 -121351 946247 -453543 -784401 -129719 -362426 800859 979794 -557734 -600809 379024 -286150 562431 -470560 -197580 185221 -117536 260725 970412 378400 -62981 695715 -589356 -516686 337386 977710 842586 -259059 -389389 929154 361805 -837551 -167309 -596299 109939 491480 638929 -637882 -384531 634873 185345 -875562 -681615 726098 639724 103627 -312116 771373 -62382 -433855 457877 620445 209567 372137 -394787 545367 -213753 976209 403952 -315402 -803503 259359 -173019 901279 -608303 -781748 -478126 -205164 -519497 184150 378389 -468354 465936 -77798 -291624 604581 447120 -834473 446333 520505 578730 -614486 23…
Output: -397957

Example 2:

Input: 4515 2651 -414866 640580 918416 597539 191329 541371 -46464 284234 -946791 -992152 251841 -140600 -937452 11080 296403 -236951 -121201 813115 243223 587572 789145 -444204 795048 407531 -53733 299779 332226 999480 -235068 23247 113630 -571501 -880684 -793443 -290750 300515 411873 -733615 -932326 719521 990184 -258324 -571453 -298342 344980 356636 -347413 -784323 -497825 -935124 930221 -825091 799757 503693 446702 226182 709144 196855 340450 -879410 458248 81549 -717302 978276 -90076 171234 990176 -348060 -747945 -497040 786048 685097 6938 974066 -119946 874897 75415 796275 102528 221979 953583 312166 -660865 345346 957519 992418 249508 -927329 -20899 -354578 -781289 871721 423700 702802 848679 -701281 -740861 -978782 540483 50874 622230 -274693 -807646 430025 10424 -443080 593497 927471 -80…
Output: 186871

Example 3:

Input: 1053 363 404595 -756418 -916621 -201635 -817458 -29466 343561 -640769 631456 -716236 346962 -697600 886780 -109060 -127714 -66019 585736 577228 -156709 802329 -750794 -3501 17211 -771224 -160691 394880 343205 -537531 -116347 -324717 788562 740304 123414 940413 -805247 -476344 643380 267757 666167 481240 -840434 -564658 -514427 593880 717456 258889 -915189 16311 -774359 -804733 781988 624421 185683 867960 -824753 497012 358422 -90633 137938 -134705 -798947 -968340 -702827 -684624 -397129 -5854 -923602 -30075 49282 620799 280921 475780 722371 509558 -989835 -930078 -66072 -787007 789499 197230 735045 -780207 -592620 606404 -399532 373245 -373214 -878044 -189630 386550 959524 -395151 -933599 -598677 131397 64198 782675 180452 619723 -622417 -982391 572065 -223167 817600 -488402 -359187 905320…
Output: -313666

Constraints:

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

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