CT32176

Last weights of Potter

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The store warden Potter has been asked to file the annual report. On the desk lies a long table of weights readings. 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 <= 5348; 0 <= a[i],k <= 1000000.

Example 1:

Input: 755 1004349 698352 237769 693527 951036 366108 995304 975656 82398 701650 894735 902576 122405 1634 333896 60604 736973 906357 842565 491867 336191 11256 916571 819321 709873 3675 707110 618400 918099 401822 400733 259629 44740 527327 648549 839318 807756 610911 69654 430975 29592 716856 907771 254671 200289 42550 351540 474085 402513 853866 879455 119255 560632 187341 66524 865698 464769 646046 114858 60421 60269 574666 431034 848287 869014 465115 35156 717199 570523 189430 300468 387034 81787 555191 982608 822187 940909 788379 522810 208782 890799 949567 518627 197170 153891 120870 951754 253974 482743 181871 9983 986936 776131 304692 822739 665819 228806 986380 357825 759197 837371 896079 41383 860691 244517 547027 186883 947053 402253 887041 497327 942973 100246 523851 314155 856692 19…
Output: YES

Example 2:

Input: 3000 193593 894885 869048 503402 965346 366614 612705 775793 942590 302310 471548 894535 586336 915370 435429 827235 596435 154854 882194 945292 377555 307990 720441 725727 234288 4687 420791 888497 193121 384046 517650 607921 715899 180940 125586 574909 649208 364633 752904 18888 361483 243824 29397 947927 900 303658 358120 70063 899799 403354 508356 152456 727912 438861 985688 318844 178152 890804 861038 932461 94607 499264 656017 303178 312942 941183 634696 286941 69182 313806 925016 116317 661704 474633 444776 98030 649542 459592 368311 833150 806224 918513 140863 138323 651143 310002 207423 175323 233033 331573 805735 357883 354871 60197 282872 543653 556135 327834 4022 442394 991770 404364 549526 552470 12432 482967 71006 75258 717503 543136 858518 777245 801941 736008 217408 759124 …
Output: YES

Example 3:

Input: 911 1827148 728216 877263 31019 90057 771575 428564 67310 553624 698819 552358 842946 346548 691087 183619 562760 364044 999816 775494 759569 152410 144979 508052 529755 817192 970307 631505 468331 916571 91642 85469 315075 58843 927561 92232 229959 780694 362099 941803 955287 838017 986269 825371 957640 773915 249278 366623 262470 228649 773512 419454 627218 871829 294698 988369 988068 872671 310154 712947 787092 794868 671785 560135 271693 340681 889821 634775 702624 829477 624327 541128 396483 364567 783350 940553 466729 899529 224319 347734 301924 531382 401519 981904 532202 162517 289375 252603 723032 499504 208341 167234 22902 179214 678936 658641 264309 551484 886453 442908 734901 10296 941874 939480 648577 157963 99015 182287 198021 367417 399231 154445 568782 979664 982344 483772 …
Output: NO

Constraints:

2 <= n <= 5348; 0 <= a[i],k <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Last weights of Potter - MEDIUM Coding Problem | CodeTikki