CT34359

The K-th Mark at Frostgate

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The quartermaster Ojas has been asked to catalog the new acquisitions. On the desk lies a long table of shelves readings. 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 <= 8351; 0 <= a[i] <= 1000.

Example 1:

Input: 3256 1261 523 331 38 689 369 291 395 977 217 722 925 140 419 655 303 210 829 284 433 715 362 828 48 887 697 591 189 871 620 332 763 406 212 1000 85 887 829 377 144 913 998 16 165 20 970 526 985 702 495 947 995 648 573 358 98 492 851 646 390 152 110 704 194 812 946 598 282 545 173 490 721 796 570 458 750 834 931 930 641 706 974 180 11 930 840 858 144 82 328 896 584 345 693 31 178 82 938 757 74 839 793 330 982 561 594 735 206 190 448 37 55 792 69 111 6 131 784 854 24 804 144 809 282 460 325 331 694 75 719 228 357 860 484 610 37 905 984 231 550 721 194 344 409 480 786 829 365 527 673 692 20 175 299 625 461 153 618 845 47 139 523 648 710 839 508 416 765 677 715 734 294 69 972 349 8 861 329 880 873 61 610 773 98 877 392 555 227 327 109 784 588 621 120 791 407 142 560 592 496 271 502 389 113 496…
Output: 390

Example 2:

Input: 5996 2263 576 29 109 89 750 876 982 713 440 94 438 987 273 755 994 889 214 706 416 454 26 647 413 920 410 963 961 217 14 202 236 10 360 927 485 439 359 590 316 78 477 793 933 649 852 529 955 242 39 296 208 107 200 218 982 118 480 451 645 262 371 917 476 449 814 297 529 343 479 668 664 948 586 572 672 599 852 420 842 997 677 711 723 215 877 881 916 453 10 838 32 180 341 751 128 813 445 559 851 493 220 496 555 850 680 459 526 360 101 810 499 448 406 470 209 848 769 980 459 505 623 332 488 214 875 928 407 595 666 308 572 973 152 938 753 714 999 184 945 232 905 878 71 1 133 361 381 196 362 618 325 581 609 209 696 183 884 58 55 347 508 57 799 375 330 56 784 807 873 209 905 728 926 847 599 775 146 367 484 301 999 931 982 847 997 94 340 659 136 541 646 880 58 91 510 283 902 173 124 355 134 629 42…
Output: 389

Example 3:

Input: 756 705 204 837 22 51 1 254 853 626 70 532 883 811 510 695 116 398 233 52 570 591 441 537 731 727 390 4 1000 467 949 111 734 923 594 177 657 716 526 120 789 193 594 650 159 874 3 868 496 656 113 39 709 321 189 954 55 960 645 144 806 46 142 649 801 923 810 654 959 738 37 245 753 695 372 566 876 617 536 626 582 619 689 176 208 916 607 408 768 673 847 250 914 245 719 835 947 983 416 413 646 799 98 269 31 832 843 693 372 801 600 828 108 190 626 302 444 593 805 577 602 851 392 255 144 247 407 76 63 224 475 684 631 42 90 196 415 519 700 274 812 241 166 295 546 861 283 125 64 382 134 438 147 461 451 318 943 293 899 483 26 985 274 473 689 63 501 988 204 299 877 673 247 907 426 86 937 356 991 861 568 373 450 305 743 246 56 563 945 963 877 900 512 361 555 547 880 416 645 844 126 496 765 3 342 548 77…
Output: 941

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The K-th Mark at Frostgate - MEDIUM Coding Problem | CodeTikki