Sub-Task Task # Result
(time)
1 0 AC
(0.000000)
1 1 AC
(0.370000)
1 2 AC
(0.350000)
Subtask Score: 25.00% Result - AC
2 3 AC
(0.420000)
2 4 AC
(0.380000)
2 5 AC
(0.410000)
2 6 AC
(0.350000)
Subtask Score: 75.00% Result - AC
Total Score = 100.00%
ohh @MonkeyD just removed his para,
@ texasgirl123, here it is
cons1=scalarproduct of (c-p,c-p)
cons2=scalarproduct of (c-p,Q0-p)
cons3=scalarproduct of (c-p,d)
cons4=scalarproduct of (Q0-p,Q0-p)
cons5=scalarproduct of (Q0-p,d)
cons6=scalarproduct of (d,d)
@Wasp , I shared the coefficients earlier, @ffloyd is confirming those are correct, but I am not handling output correctly.
Can you please just help me in output part?
@ wasp
i will not copy the code
i will surely change the full code so it will not lead to plagiarism.
as if i will copy paste the code then my ranking will also goes down , so don't worry i will definitely change the whole code so that it will not lead to plagiarism
@MonkeyD
i just saw your output values the above you pasted here
T1=(-B+sqrt(B*B-4*A*C))/2*A;
here in execution first the numerator divided by 2 and then all that shitty stuff multiplied by A
it should be first T1=(-B+sqrt(B*B-4*A*C))/(2*A);
first correct it ,even it creates problem then we will go for it
Got AC. thanks @ffloyd you actually pointed out my error :D
Sub-Task Task # Result
(time)
1 0 AC
(0.020000)
1 1 AC
(1.340000)
1 2 AC
(1.320000)
Subtask Score: 25.00% Result - AC
2 3 AC
(1.360000)
2 4 AC
(1.340000)
2 5 AC
(1.360000)
2 6 AC
(1.290000)
Subtask Score: 75.00% Result - AC
Total Score = 100.00%
@MonkeyD I don't know man. I broke the points into coordinates. It took 5 minutes extra but removed all the discrepancies of dot and cross product rules. Just follow this formula : r^2 = ((Q(t)-p)x(P-C))^2 / (Q(t)-P)^2
Break the points in their respective coordinates and follow the approach that @lastchance told to separate t-terms from the equation. And don't forget to put brackets according to BODMAS rule while giving the output which was what i was doing wrong! :)
@texasgirl I would insist you try once more with the above approach. Changing variables to avoid plagarism won't help much :(
PS : Compute the constants stepwise and not in one go to avoid mistakes.
@MonkeyD:
give me the coefficient else match with my coefficient which was i pasted above
the coefficients which was i pasted gave me AC in all the test cases
@ffloyd My coefficients are exactly equal to yours, am still getting wa.
If you could open your PM, i could send you my code for review? or If something is wrong in this you could point out:
Did anyone get all AC(I am getting TLE on 70 marks subtask) on Sheokhand and String?
I got partially 30 points correct!.
Can someone explain me how can I remove the TLE?Any efficient approach?
Thanks.
@ffloyd
@the1marvellous It's a different thread. But just use tries and take an array of indices[] in the node structure. That array will contain the indices of the strings in which the character at the node appeared. Then find all the strings which has LCP with P and check which of those strings' index lie in the range(1,R).
@MonkeyD Your ouput code is exactly same as mine :-/ not sure about the coefficient part but this is 100% correct. Just to confirm this is my code in Python:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
if A==0:
t = -1*C/B
print(t)
else:
t1 = (-1*B + (B**2 - 4*A*C)**0.5)/(2*A)
t2 = (-1*B - (B**2 - 4*A*C)**0.5)/(2*A)
t=0
if t1<0:
t=t2
elif t2<0:
t=t1
elif t1>=0 and t2>=0:
t=min(t1,t2)
print(t)