Sir, I am getting wrong answer in game theory-3 question…my solution is passing all the given test cases…
could you please help me find out what’s wrong with my approach??
my solution link:
Getting wrong answer in Game Theory-3
@raghurajj
your code doesnt even pass the sample test case.try to dry run for that
here u can refer to this code for the correct approach
@aa1 in your code in line 79:
ll numofpiles should be equal to divisors[n][i]; right ??
and size of each each pile should be n/numofpiles;
as given in question we are dividing a pile A into B new piles of size A/B with each pile having size A/B.(where B is a divisor of A).
please clarify this doubt…
@raghurajj
no consider this test case
2
2
4 2
3
5 2 3
The second player wins if we consider the following moves :-
Player 1 breaks down 4 into 2 piles of 2 -> 2 2 2
Player 2 breaks down 2 into 2 piles of 1 -> 1 1 2 2
Player 1 breaks down 2 into 2 piles of 1 -> 1 1 1 1 2
Player 2 breaks down 2 into 2 piles of 1 -> 1 1 1 1 1 1
Player 1 now has no move therefore he loses.
@aa1 , in the step " Player 2 breaks down 2 into 2 piles of 1 -> 1 1 2 2 "
here A is 2 and B is also 2 . but in question it is given that B>1 and B<A …so how can this be possible…
please explain .
@aa1, and also you didn’t cleared the doubt i asked above about line number 79 in your given code…please clarify that too