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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.