Help needed in Cherry and Dr.Strange

Link to question-> DRCHE Problem - CodeChef
Link to my submission-> CodeChef: Practical coding for everyone
Help in debugging would be very helpful.

Here is a test case for which your output is wrong

1
1
10

Output should be Cherry 6 but your Output is Cherry 10
You need to push z/2 in priority queue when the size of priority queue is 1.
Here is your code which gets accepted after that change
https://www.codechef.com/viewsolution/24894128

1 Like

In your code when the priority queue becomes empty, you are simply adding that number but you are not inserting the halved of that number. Since when only one element is left, it will be definitely unique and hence it should be halved and added back to queue.

The code which got accepted after one change.
https://www.codechef.com/viewsolution/24894490

1 Like

Missed that, thanks for the help.

1 Like

Missed that, thanks for the help

1 Like