CT30904

Varun's Violet shelves

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Varun runs the timber yard at the bamboo terraces of Verdantstep. Today the books show a list of shelves, 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 <= 5235; 0 <= a[i],k <= 1000000000.

Example 1:

Input: 3742 855596816 340007100 285278594 243119848 110436065 722870517 263676688 934302708 946256098 147616377 908342782 434339076 943334389 877253608 133343526 304511196 153463844 510889904 455128842 760415297 18402627 321147835 308665922 76015788 713177272 68891793 529973293 387562691 5842242 219707240 977670242 270903232 516109950 303360960 870672766 880933191 314586718 778752567 312186767 661972497 668358527 444584963 43046010 940659737 752797458 304196353 743825593 570545572 586079979 345370756 483842703 622659342 138128333 245762782 69416847 177727456 689861225 207935816 640256957 805707719 792294062 171325905 264451274 7626848 543057633 652168934 505689774 918899939 841184643 87696697 313358953 315540958 507163235 806817491 405737425 184369089 44134428 301876939 863545483 725355000 331774…
Output: NO

Example 2:

Input: 3096 1964678100 591139550 325387084 333504410 736142048 410569147 992109381 113266894 984629114 33228444 710123011 761359639 504795426 978884012 928879661 716448958 440040515 241849116 792251500 251613181 85997113 246313087 832619186 801368579 660903841 102731876 483538842 769761505 569583030 692043404 801351119 642771887 722312057 474708107 377030729 165764868 884386672 474751555 443550665 570937871 32260146 444915458 774071497 251796783 20444059 202993232 279660146 332615700 591922127 170406684 646545554 840868312 230543795 304753202 204490070 749798979 214587004 983015628 34740558 508119885 222320073 633911413 524313397 989395110 469478411 410655270 937081560 891933536 408575496 461988983 153455680 277057871 388643413 828512811 970841093 477150352 545331607 596612880 828325038 631121898…
Output: NO

Example 3:

Input: 2186 1676922066 738518815 333037675 769924028 563862833 181603282 411195061 352842633 793386151 102348778 252438246 252376595 488036659 15911571 869486708 632448927 455938259 781556851 673948141 366127889 83373775 276762328 70219565 844148528 412808116 833665917 912895459 306840670 936942856 670642925 520110430 488577144 516900991 686772891 893100416 522668182 69792185 358203736 575758994 316951963 951332065 211637009 956159522 589069100 446459911 556266956 310065886 829341156 44516156 887655504 926743717 417727246 357556192 640028058 76141245 151568266 339558500 185485525 595349606 246792833 454977674 148400800 928416712 380705038 553657156 441301984 680472638 822287815 35734127 376414092 788699182 803713175 361005300 764673395 527020444 282347250 661197543 203612485 756401196 92198028 51…
Output: NO

Constraints:

2 <= n <= 5235; 0 <= a[i],k <= 1000000000.

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