Solution for VSN not accepted

Can somebody please find out mistake in my solution ? I compared with those which were accepted, my equation matches, and the way i wrote the equation in quadratic, there is no chance of getting overflow in data types. I would be really glad if someone finds a mistake :slight_smile: I believe there is not a single error in my solution.

Solution : https://www.codechef.com/viewsolution/18838079

Here is an AC solution: https://www.codechef.com/viewsolution/18890702

Mistakes:-
First:

long long int l3=k1k1+k2k2-radius*radius;

    long long int l1=k2*k2+k3*k3-radius*radius;
    long long int l2=k1*k1+k3*k3-radius*radius;
    long long int b=2*(b1*l1*dx+b2*l2*dy+b3*l3*dz-k2*k3*(b2*dz+b3*dy)-k1*k2*(b1*dy+b2*dx)-k1*k3* b1*dz+b3*dx));
     long long int a=(dx*dx*l1+dy*dy*l2+dz*dz*l3-2*k2*k3*dy*dz-2*k1*k3*dz*dx-2*k1*k2*dy*dx);
     long long int c=(b1*b1*l1+b2*b2*l2+b3*b3*l3-2*k2*k3*b2*b3-2*k1*k3*b1*b3-2*k1*k2*b1*b2);

In the above lines, k2k2+k3k3, since both are long long and multiplication causes overflow.
You should have written 1.0 * k2 * k2 + 1.0 * k3 * k3 and made variables long double.

Second:

time1=(long double)((-b+sqrt(bb1.0-4ac1.0)1.0)/2a1.0);

time2=(long double)((-b-sqrt(bb1.0-4ac1.0)1.0)/2a1.0);

You should have written
time1=(long double)((-b+sqrt(bb1.0-4ac1.0)1.0)/(2a1.0));
Note the brackets in 2 * a * 1.0.

Third:
You have not used \n after printf.