1. 程式人生 > >hdu4753Fishhead’s Little Game【狀態壓縮記憶化搜尋+博弈】

hdu4753Fishhead’s Little Game【狀態壓縮記憶化搜尋+博弈】

   There is a 3 by 3 grid and each vertex is assigned a number.


   It looks like JiuGongGe, but they are different, for we are not going to fill the cell but the edge. For instance,


adding edge 6 –> 10

   The rule of this game is that each player takes turns to add an edge. You will get one point if the edge you just added, together with edges already added before, forms a new square (only square of size 1 is considered). Of course, you get two points if that edge forms two squares. Notice that an edge can be added only once.


forming two squares to get two points

  Tom200 and Jerry404 is playing this little game, and have played n rounds when Fishhead comes in. Fishhead wants to know who will be the winner. Can you help him? Assume that Tom200 and Jerry404 are clever enough to make optimal decisions in each round. Every Game starts from Tom200.