Day1T1 hamster stones game - Game Theory

Playing the game when not study game theory, kick down and spent half an hour completion, this problem is to find a \ (SG \) function
in fact, it was almost on the \ (YY \) an answer, but the back too hard to think, so do not come out whole
Room bigwigs say they did not study game theory, but have AC

answer

To pretend we know everything \ (SG \) function and \ (NIM \) game, a moment later repeat

Assume the upper hand rabbit (I) put the Black hamster (small underground) put the White

First, this question of \ (n \) ring can be considered \ (n \) independent \ (G_1, G_2, G_3 ... \) directed graph games together constitute \ (G \) game
then $ SG (G) = SG (G_1) $ \ (XOR \) \ (SG (G_2) \) \ (XOR \) \ (SG (G_3) ...... \)
so we only need to construct each ring the \ (SG \) function can (in fact, this question does not need to construct
a quick configuration ah
hand to play with the sample, we found that when \ (a [i] = 1 \) when the state has the upper hand to win
another ye do it
a lot of manpower to play sample bet for a moment losing state has the upper hand, then really \ (a \) , and even the explanations are written so ......
But honest I did not ......

Ahem, there will be lost first state if and only if all the empty positions are next to Black.
Then we can list all of the losing state

First, an empty location must not close together, or a fill color can move
followed Black White number must not differ by more than one (multiple and Black), and the gap must be omitted Black White alternatively appear alternately, because if there are two adjacent chess the same color, then there must be a gap therebetween, and this space can fill another color chess
then you can be certain that the number of Black White last as much
consideration parity
when \ (a [I] \) is odd, the next turn Black, Black if to be placed, must be adjacent to another Black, losing the upper hand
when \ (a [i] \) is even, next turn Black, Black did not have to go, losing the upper hand
so when $ a [i] $ is not \ (1 \) when, \ (SG (G_i) \) are \ (0 \)
is \ (1 \) are when \ (1 \)

So finally \ (SG \) function \ (XOR \) click on it

Hey……

To sleep tonight, send the code tomorrow ......

Guess you like

Origin www.cnblogs.com/with6676/p/11762512.html