CT21847

The Twilight Pair Quest

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

At the monsoon port of Rainhaven, Hugo records each shelves in a worn leather ledger. The guild wants answers, not guesses. 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 <= 349; -1000000 <= a[i],k <= 1000.

Example 1:

Input: 276 -1812960 -108886 -106251 -41599 -251133 -537542 -379295 -967185 -867534 -27651 -266464 -834860 -364793 -242769 -78493 -824591 -239119 -637556 -488995 -509518 -420360 -893990 -227668 -438093 -668693 -166029 -375589 -402329 -529816 -119075 -106798 -771136 -854130 -107251 -123120 -573363 -59279 -929809 -761025 -924097 -534895 -853529 -361822 -425705 -891321 -196172 -673053 -963405 -483525 -822947 -290782 -705220 -627372 -297413 -837126 -21149 -606100 -664610 -859905 -14051 -635413 -748673 -730407 -457308 -414534 -321480 -194155 -347485 -62071 -516829 -330161 -921305 -821301 -509848 -661761 -694983 -683685 -613370 -246028 -683099 -355017 -184217 -414177 -451918 -337 -867822 -45676 -488211 -896659 -488962 -148020 -291614 -621659 -143905 -506156 -389831 -795536 -232432 -92551 -724216 -979224…
Output: YES

Example 2:

Input: 191 -774309 -790419 -184461 -13007 -331016 -50185 -825310 -843905 -244521 -733145 -101950 -156949 -959479 -829119 -992133 -252853 -666806 -500219 -576235 -577772 -362662 -20599 -747090 -685033 -75778 -390548 -719214 -815224 -635810 -209782 -709403 -603915 -35198 -692135 -993152 -399386 -805773 -940713 -1771 -4407 -60300 -959463 -320694 -954465 -635621 -284852 -747011 -955880 -718617 -588997 -28852 -912131 -607118 -285656 -316509 -165688 -343189 -513459 -981271 -55344 -257389 -449140 -973585 -771539 -594910 -186418 -613368 -894496 -348644 -298698 -2719 -976662 -904307 -831295 -911381 -662219 -408296 -139960 -234400 -768459 -585500 -964628 -107600 -488319 -736461 -767715 -162387 -328197 -236714 -782182 -789528 -841975 -273867 -825752 -881980 -642315 -715986 -572416 -224482 -751861 -159789 -1…
Output: YES

Example 3:

Input: 153 -446052 -478424 -125775 -827058 -70041 -813136 -799568 -578150 -575250 -115865 -795941 -104501 -863364 -118498 -183160 -730267 -642482 -213860 -847904 -512331 -828253 -555109 -53359 -320867 -636608 -339601 -610364 -227514 -12509 -922761 -877461 -987833 -813850 -493758 -869252 -712109 -27012 -830033 -614639 -489577 -114845 -135409 -950374 -221225 -387993 -605325 -523157 -109268 -838808 -354010 -422207 -206261 -167661 -252603 -163397 -316292 -5654 -48104 -462689 -517350 -775126 -45598 -728850 -342743 -468581 -778919 -742368 -851339 -650005 -865172 -879904 -151320 -80809 -737951 -984529 -340525 -818144 -220175 -960909 -764284 -173721 -100998 -997140 -413822 -873520 -463884 -70387 -139578 -204452 -164030 -170946 -90875 -679142 -323220 -735108 -429985 -566084 -198867 -441131 -657756 -207302…
Output: NO

Constraints:

2 <= n <= 349; -1000000 <= a[i],k <= 1000.

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