yelghareeb's blog

By yelghareeb, history, 6 years ago, In English

In problem 768E - Game of Stones, there are n piles, each with s stones (1 <= s <= 60). Players alternate moving as in the ordinary Nim with 1 restriction: no move can be made more than once on a pile (e.g. cannot remove 4 stones from pile 1, if 4 stones were previously removed from it).

The intended solution is to use dynamic programming with bitmasks to calculate the Grundy value for each pile size, state = (number of stones, mask), where mask represents the available moves.

However, I coded a simpler solution and got AC. The problem turned to be equivalent to taking a larger amount of stones at each step (Submission: 33990154). I don't fully understand this equivalence, and whether it's correct or not. Can anyone shed light on a formal proof for this?

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