First 3 test cases not being passed

Hi @mohammadabdullahjawwad
Your code are failing those test cases in which variable are going out of limit of int so use long instead of int then all test cases will pass.

But the given constraints are falling in the range of int

Hey @Aayush, it worked! But please let me know how it did

Hi @mohammadabdullahjawwad
See that in isValid function :

bool isvalid(long n, long m, long x, long y, long mid) {
if(m+(n-mid)y >= midx) {
return 1;
}
return 0;
}

We are multiplying two numbers that is why data type should be long int because multiplication of two int value can exceed 10^9.

Okay got it. Thanks a lot @Aayush

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.