CT31284

The Pair Quest of the Crystal crates

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Kavi runs the workshop at the galleon yard of Masthead. Today the books show a list of crates, and the numbers must be worked out before sundown. Task: Print YES if two distinct elements sum to exactly k, otherwise NO. Input format: First line: n and k. Second line: n integers. Output format: Print YES or NO. Constraints: 2 <= n <= 14108; 0 <= a[i],k <= 1000.

Example 1:

Input: 12863 237 513 5 479 136 367 668 86 743 629 773 831 306 490 297 943 373 709 393 109 794 367 288 69 713 130 742 332 323 214 332 837 247 328 831 933 275 13 13 75 702 55 461 869 909 562 910 321 536 18 498 618 74 27 502 340 803 317 791 314 605 88 807 564 84 866 927 257 523 213 301 25 223 386 818 255 81 399 737 781 983 759 0 386 225 523 20 558 558 176 898 473 751 999 508 883 752 87 364 78 12 617 123 164 832 635 757 443 813 708 370 971 180 822 559 816 116 336 508 313 704 113 779 899 940 380 26 601 688 997 725 814 622 478 435 613 8 935 149 448 778 242 670 457 419 299 345 997 193 661 576 811 521 184 327 593 894 302 683 246 148 568 775 882 335 510 929 79 481 262 969 733 543 58 965 311 829 444 405 939 472 991 112 561 304 971 173 312 872 218 655 781 983 485 789 193 258 985 910 740 161 934 518 602 196 …
Output: YES

Example 2:

Input: 1650 791 458 644 77 127 722 636 298 788 723 90 37 113 662 218 137 807 53 718 369 556 452 90 703 201 811 630 811 599 128 703 252 335 84 776 389 13 202 770 351 90 83 616 420 654 720 393 894 219 449 214 670 507 905 427 345 978 511 232 946 133 641 951 961 505 753 709 718 286 969 11 275 41 973 961 942 429 648 146 730 401 930 765 755 998 341 746 106 415 795 570 211 525 332 171 403 206 578 548 104 621 999 228 532 753 340 722 135 604 181 570 32 96 858 779 543 241 578 842 559 58 940 664 470 263 231 281 846 108 215 15 402 803 782 610 139 771 737 170 563 715 81 979 234 335 261 129 117 389 291 652 35 247 605 458 749 701 561 652 579 501 123 796 333 685 415 927 208 418 784 275 485 336 407 895 897 933 327 281 391 80 880 744 284 622 178 207 821 507 506 364 967 757 30 239 374 248 868 897 88 392 816 92 254 …
Output: YES

Example 3:

Input: 2570 596 513 456 354 427 312 866 322 667 240 539 134 126 301 499 457 17 562 856 821 40 376 914 578 852 53 274 383 710 147 936 696 830 990 996 272 530 362 955 954 423 926 497 487 990 969 303 835 73 512 194 623 697 919 26 649 292 653 956 131 980 738 238 92 199 617 819 575 382 920 257 324 192 954 585 10 599 13 86 225 199 533 50 611 291 337 169 957 262 564 667 940 566 687 701 965 713 854 750 395 950 877 841 680 586 47 23 643 841 325 975 870 443 796 719 186 865 731 427 323 63 349 82 84 887 307 537 362 307 623 991 935 518 199 800 630 577 60 977 144 288 577 445 410 248 736 621 314 839 603 384 7 349 528 591 843 190 222 125 48 914 600 900 289 106 288 816 578 802 538 424 49 486 638 557 84 113 83 79 856 641 758 802 979 515 194 479 964 465 768 66 336 325 738 498 105 849 234 772 906 35 508 686 661 846 …
Output: YES

Constraints:

2 <= n <= 14108; 0 <= a[i],k <= 1000.

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