BUDDYNIM(SNCKPE19) huge error.

Two Random AC codes giving different answers for BUDDYNIM! No offence to the code owners, but it took almost two hours of my team to reach to a verdict for a test case of this question.

The test case:


2 2

1 2

4 7

gives answer as “Alice” in one of the codes and “Bob” in the other. I wonder what is the correct answer because both of those codes have almost no relation in between, and this resulted in our WA with lots of time wasted too.
We checked the codes of two random people and with no offence to them, I’m posting the links to the codes for verification from your side.


CodeChef: Practical coding for everyone

Thank You!


Correct answer is Alice since she can choose table 2 and keep decrementing by 1 and Bob will run out of moves. I guess test cases were weak :frowning:


Yes,true! One of the solution is not even passing the given testcases and it is there in successful ones. It is nothing but just a random brute force! This was the first question of the pre-elimination and that too with such weak testcases. Pathetic!

Solution Link - CodeChef: Practical coding for everyone

Expected Ans -




Ans by this solution -




I completely agree with you!These two solutions are giving diff. answers! @include_sajal

Kindly look into this matter! @mgch @kingofnumbers


I am supposing that Bob win if and only if sorted(a) == sorted(b). But this solution has got WA.
Am I right?

1 Like

As it has turned out there are possible piles consist of zero items! Pretty logic. Childlike catch.

If I could got AC for this task then I’d qualified for next round. But with such tasks maybe it is better for my calmness that I did not.

1 Like

Yeah, absolutely correct, I had the same in mind, but was totally confused after seeing the answer as “Bob” in one of the codes. Test cases were not just weak, they were a blunder, as I just saw an AC code giving wrong answer for sample test case only.

I got my solution accepted using the same logic. Don’t forget to remove 0’s from the inputs.

0 0
0 0 0

Answer should be Bob not Alice