cantsolvediv2C's blog

By cantsolvediv2C, 15 months ago, In English

Hello Codeforces community! Hope you all are doing well.

I need some help in understanding misere version of games.

First, let's start with the classic misere nim. I have no idea why its solution works. I have seen the proof (without using Sprague-Grundy theorem) of the normal nim and it is understandable that the xor-sum = 0 state is a losing state and if I start with non zero xor-sum I can push my opponent into a xor-sum = 0 state and then my opponent cannot make a move and keep the game in a xor-sum = 0 state. Why should this even work for the misere version ?

Upon googling, I found [this](https://math.stackexchange.com/questions/375114/nimbers-for-mis%C3%A8re-games) article. While the author mentions of deleting the outdegree = 0 states and corresponding incident edges and labelling the grundy value of newly formed outdegree = 0 states as 0, the "correct answer" mentions labelling grundy value of original outdegree = 0 states as 1. The procedure of calculating grundy values for the rest of the states remains the same as in case of normal version. If I apply these to the misere nim, I obtain the following sequences respectively:

state, grundy : <1 0>, <2 1>, <3 2>, <4 3>, ... (Author)

state, grundy : <0 1>, <1 0>, <2 2>, <3 3>, <4 4>, ... ("Correct Answer")

However, neither of these sequences explain why N = 3, A = {1, 2, 3} is a losing state for First Player to move.

Next, I was trying to solve [this](https://mirror.codeforces.com/contest/1312/problem/F) problem which looks like a misere game. But the accepted solutions I have checked all did the following: rep(i, 0, 3) grundy[0][i] = 0. My question is why ? Those are winning states, right ? Then why ? And if it is true that if the grundy value of the initial state is 0 then it is a winning state then why doesn't this work for the misere nim and why would that be even true in the first place ?

Full text and comments »

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

By cantsolvediv2C, history, 15 months ago, In English

Hello Codeforces community! Hope you all are doing well.

I need some help with the following question that I had while understanding xor basis.

Given an array A. You need to tell how many arrays B of length n exist that satisfy the following property: For each A[i], a subset of B exist such that its xor is equal to A[i] and 0 <= B[i] < 2^k.

Full text and comments »

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