We invite you to participate in CodeChef’s Starters 51, this Wednesday, 10th August, rated for Div 2, 3 & 4 participants.

Time: 8 PM — 11:00 PM IST

Joining us on the problem setting panel are:

Contest Admins: Jeevan Jyot JeevanJyot Singh, Utkarsh Utkarsh.25dec Gupta

Setters: Ashley errorgorn Khoo, Allen ijxjdjd, Jeevan Jyot JeevanJyot Singh, Utkarsh Utkarsh.25dec Gupta, Hriday the_hyp0cr1t3 G, Yash kulyash Kulkarni, Abhinav abhi_inav Gupta

Testers: Abhinav abhinavvv306 Sharma, Venkata Nikhil Nikhil_Medam Medam

Statement Verifier: Nishank IceKnight1093 Suresh

Editorialists: Nishank IceKnight1093 Suresh

The video editorials of the problems will be available on our YouTube channel as soon as the contest ends. Subscribe to get notifications about our new editorials.

Also, if you have some original and engaging problem ideas and are interested in them being used in CodeChef's contests, you can share them here.

Hope to see you participating. Good Luck!

Reminder: Contest starts in 20 mins.

Reminder: repair your servers

Hint for Chef and Cook game???

Reducible to NIM game...A[i] elements at index 'i' have distance N — i from the end of the array ,which is equivalen to having N-i stones in a NIM pile..

Can you explain this fact

`A[i] elements at index 'i' have distance N — i from the end of the array ,which is equivalent to having N-i stones in a NIM pile..`

a bit more..

If you are familiar with NIM game(Sprague grundy theorum)..WLOG consider A[i] = 0 or A[i] = 1.(binary array)...If A[i] = 1..This element can be moved to any index j>i and j<=N. You can perform a move on this element till its index becomes N. In other words the value of N — i can be decreased by any amount just like game of NIM.

This can be extended to any array A .. by transforming A[i] = A[i]%2 since x^x = 0 and the parity of A[i] only matters.

Short solution outlineWe can biject this game to the normal nim game. For each $$$i$$$, we will create $$$A_i$$$ piles of $$$N-i$$$ stones.

You can also have a look at the complete editorial.