• + 0 comments

    I made this way harder than it needed to be by calculating the coefficients of the quadratic equation which of course gave me overflow issues with very large numbers when multiplying very large numbers by sqrt(2). I got overflow issues as well as errors. I tried to solve those issuse until I realized that I can get a straight equation that doesn't require the multiplication of very large numbers and got the result! the derived equation is: t=sqrt(2)*(l-sqrt(q))/abs(s1-s2) and you just need to loop through the queries!