DESSERT WIZARD:WHAT IS WRONG IN MY CODE?

HERE IS A LINK TO THE PROBLEM : DELISH Problem - CodeChef
AND THIS IS A LINK TO MY SOLUTION :CodeChef: Practical coding for everyone
CAN ANYBODY TELL ME WHATS WRONG IN THIS CODE? I AM NOT EVEN ABLE TO GENERATE A TEST CASE FOR WHICH IT FAILS.ANY HELP WOULD BE APPRECIATED.

when i used std::min and std::max in your code the solution got accepted.link to the accepted code CodeChef: Practical coding for everyone
i dont know why its happening.this is all i could do.hope this helps :slight_smile:

1 Like

The culprit was abs function from stdlib.h. It is only for ints. So, implementing separate abs function solved the problem: CodeChef: Practical coding for everyone @abhinav1234 I hope you also got why your changes in the code got accepted. Because std::abs is not same as abs from stdlib and it works for long long too!

1 Like

Thanks i got it :smiley: