DialogData C1 (week 2)


2020-07-10 09:00 AKDT

DialogData C1 (week 2)


2020-07-17 09:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -76 days 6:51:02

Time elapsed


Time remaining


Problem B
Add 'Em Up!

Simon is a contestant on the new exciting game show, Add ’Em Up! In this show, contestants are given a set of cards with multi-digit numbers on them, and need to select two cards that add up to a given sum. However, to make things more interesting, the font that the cards are printed in (see below) means that certain cards will display different numbers if turned upside-down, and it is legal to turn either or both of the cards if necessary to generate the sum. Please help Simon win the game!

\includegraphics[width=0.6\columnwidth ]{cards.png}


The first line contains two integers, $n$, the number of cards, and $s$, the desired sum. The second line will contain $n$ integers between $1$ and $100\, 000\, 000$ inclusive. You may assume that $1\leq n\leq 100\, 000$ and $2\leq s\leq 200\, 000\, 000$.


The output should be a single line consisting of the string YES if two cards can be chosen such that (in some orientation) they add up to $s$, and the string NO otherwise.

Sample Input 1 Sample Output 1
3 66
15 21 22
Sample Input 2 Sample Output 2
3 63
15 21 22