HELP:- WORTHY MATRIX(April long challenge2021)

can anybody please tell me what wrong in my code. it gives WA for only one subtask and i am not able to find out that mistake.
solution link:-CodeChef: Practical coding for everyone

There was some error in the binary search function. And my advice for you is not to work with doubles as there may be precision errors. In order to overcome precision errors in division, re-arrange the equation and change it to multiplication.

For example, to check if (A / B) \ge C , re-arrange equation as A \ge (B*C) in order to overcome division and precision errors. This way you can also avoid divide by zero error.

Iā€™ve made changes in your sumq, bsearch functions, and also in line number 81. Check those out and ask your doubts if any.

Link to my AC submission of your code with some changes : Link

Happy coding :grinning_face_with_smiling_eyes:

1 Like

Thankyou so much for your help. :blush: