All submissions for this problem are available.
Saksham could not come to school so Daksh and Sidhant were getting bored. Daksh suggested to play a simple game to
pass their time.
He takes a bag having N coins and a Deck X having K cards each having a number on it (not necessarily distinct). The two take turns with Daksh starting the game. choosing a card of his own choice and then removes the number of coins from the bag as that written on the card and then replaces the card back to the deck.
Assume that both players play optimally. You have to tell the cards which Daksh can pick at the first move to ensure his victory.
The first line of the input contains two numbers N and K.
The second line contains K integers X[i] which denote the numbers on the cards in the deck X.
You have to output two lines. The first having the number of cards which can be taken and the second line having the values on those cards in non-decreasing order
Sample Input 1
8 5 8 3
Sample Output 1
Sample Input 2
Sample Output 2
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.