HERE IS A LINK TO THE PROBLEM : http://www.codechef.com/problems/DELISH
AND THIS IS A LINK TO MY SOLUTION :http://www.codechef.com/viewsolution/3307572
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 http://www.codechef.com/viewsolution/3312030
i dont know why its happening.this is all i could do.hope this helps
1 Like
The culprit was abs function from stdlib.h. It is only for ints. So, implementing separate abs function solved the problem: http://www.codechef.com/viewsolution/3312789 @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