nownikhil's blog

By nownikhil, 11 years ago, In English

http://www.spoj.com/problems/BOMBER/ I was trying to solve this game theory problem. basically at every step we split a block in 4 sub blocks. It is something like kayle's game, and hence its logic can be used. So we need to compute grundy number for every block of size X*Y. I am not able to think of an efficient method for this problem.

There was another problem. Variant of Nim. In this pile sizes should be in increasing order. In one move a person can either remove an entire pile, or reduce its size maintaining the property that pile sizes are strictly increasing in length. Can we simple consider new set of piles where each pile size is the difference between consequtive pile sizes.

Thanks in advance. Any help is greatly appreciated.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
11 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Yes, you can solve "bomber" problem by splitting a block in 4 sub blocks. I tried to calculated grundy number for every block of size X*Y, but got TLE. With small optimization I got AC. We can calculate for every block of size X*Y (where X < Y), because grundy of block (X*Y) is same with grundy of block (Y*X).

Hope it was useful.