WA in Game theory 3

My code: https://ide.codingblocks.com/s/214714
Can’t get the wright answer, followed the tutorial, and I wanna know how to decide if grundy number of given ‘n’ is 0, for eg:- in this case all primes and n==1 will have grundy numbers = 0 (by taking base case??) also in the editorial only code is given, can you update it with proper explanation?

@utkarsh.lal9430310535
Your find divisors is wrong
You need to push divisors if they’re prime starting from 2
You’re pushing each number starting from 1

I’ll forward the explanation concern to the team

If your doubt is resolved please close it

// grundy for prime numbers and 1 will be 0 according to problem   
if(n == 1)
         return 0;
if(n==2 || (n%2!=0 && primes[n]==0))         
      return 1;

This is inside the code to calculate grundy numbers in the editorial,
The comment line also specify grundy no. for primes should be 0 but it’s written 1 here?
One of them should be Wrong, right?
My rectified code
this is also getting WA verdict, can you please debug it?
also, i don’t get the point that if a pile is broken into even no of parts then it doesn’t contribute to our answer why do we still insert ‘0’ in our Mex set

@utkarsh.lal9430310535

  1. Yeah the second one should have been 0
  2. Since you have the editorial opened now I request you to cross verify your approach with that one, you’ll learn to debug better
  3. Game theory 3 way of approach you can see the explanations here

i can’t understand the test case :5 2 3. the first player can’t make any moves as all numbers are prime, how can then 1 win??? Please help as i have been stuck in this Question for a long time now.

@utkarsh.lal9430310535
Please refer to this correct code to see the complete implementation and clear your doubts

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.