CT26392

The K-th Mark at Vineward

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the ivy courts of Vineward opens only for a perfect tally of ledgers. Freya means to find out. 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 <= 288; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 170 12 454410712 315214811 641063000 605091542 245177489 536901013 687098405 303277599 85014711 320909347 946779242 477164062 609065963 72441258 102320624 448268352 103287263 877274664 861354551 827025393 263510991 135359353 523029944 496892221 527797100 613590933 292539274 555558085 765579979 75745359 111191358 870106814 486357678 602563094 191458891 97897069 796869914 205211370 27889592 522895262 756849031 783001425 123053707 951607850 962701519 949058111 299822778 577815195 321560428 568285520 965813416 358285928 917522351 687069454 565047734 142648226 765132293 995877409 402375522 187838322 634837638 403589915 652336498 856556847 951088697 189808599 614428221 715385240 683975973 777687682 503999887 615407275 881877680 800603778 415515745 833929965 91555448 350291991 623026425 482904552…
Output: 97897069

Example 2:

Input: 260 172 304185257 895874792 158092420 594114762 34637331 530744070 996694809 878835533 409894660 450074891 273379601 860570937 811319841 93440848 499642727 516432570 440524989 104659486 218786569 457367293 179452295 31065461 126073983 585965565 569738225 586451786 218103352 502465388 322284186 866128868 477745522 869146050 951203905 139527370 574638410 856471330 829091055 153008510 261839438 286801521 715183783 447921446 475301806 785664485 82544791 716609797 487897244 631539907 820479701 893489031 569278575 310607245 799270144 159990120 134465611 364231932 408997125 736069355 440037897 45149411 535470062 998212205 674173481 753553744 779321507 198506255 125997804 7034828 883585850 675976345 335448284 755190262 304335164 303714429 112117819 864124911 782365250 45840014 425056233 821028944 …
Output: 643458856

Example 3:

Input: 4 1 680603023 186636293 385488058 287505878
Output: 186636293

Constraints:

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

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