JeevanJyot's blog

By JeevanJyot, 2 months ago, In English

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:

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!

 
 
 
 
  • Vote: I like it
  • +34
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Reminder: Contest starts in 20 mins.

»
2 months ago, # |
  Vote: I like it +10 Vote: I do not like it

Hint for Chef and Cook game???

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    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..

    • »
      »
      »
      2 months ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it

      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..

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it
    Short solution outline

    You can also have a look at the complete editorial.