ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1600. Airport

kolesnik_av If you got WA#3 or WA#16 [8] // Problem 1600. Airport 24 Mar 2008 23:20
ds:=sqr(b)-a*c;

the checking must look like this
if ds+0.000000000001>=0 then
...
Olympic Bear (Nikolay Dubchuk) Re: If you got WA#3 or WA#16 // Problem 1600. Airport 10 Jun 2008 17:36
Also when I calculated square roots for
a*t^2 + 2*b*t + c = 0 as
t1,2 = (-b +- sqrt(b^2 - a*c)) / a
I had wa3.
When I use b = 2.0 * b
t1,2 = (-b +- sqrt(b^2 - 4.0*a*c)) / (2.0*a)
I got AC.
It is very curiously...
yujj Re: If you got WA#3 or WA#16 [4] // Problem 1600. Airport 13 Jun 2008 15:05
I has WA#3. Even, i use check ds+0.000000000001>=0. I don't understand what's wrong. :(
Can you talk me what in test 3?
Hadi Moshayedi Re: If you got WA#3 or WA#16 [3] // Problem 1600. Airport 24 Jul 2008 15:18
If ds passes this test, it may be less than zero. so, if it is less than zero, reset it to zero. otherwise, sqrt won't perform as expected.
Denis Koshman Re: If you got WA#3 or WA#16 [1] // Problem 1600. Airport 19 Aug 2008 04:14
Also check for possible -0.000 replies (that happens in printf("%.3lf") when number is negative, but becomes zero after round-up). Some checkers do not like that.
Linas Re: If you got WA#3 or WA#16 // Problem 1600. Airport 19 Oct 2008 22:40
Is negative time a possible answer? :(
Azrail Re: If you got WA#3 or WA#16 // Problem 1600. Airport 1 Dec 2008 14:14
There is curious fact, that you can get AC with eps = .1!
Most important do not forget about:
Hadi Moshayedi wrote 24 July 2008 15:18
If ds passes this test, it may be less than zero. so, if it is less than zero, reset it to zero. otherwise, sqrt won't perform as expected.
Felix_Mate Re: If you got WA#3 or WA#16 // Problem 1600. Airport 30 Aug 2015 20:40
Thanks!
Mortus Re: If you got WA#3 or WA#16 // Problem 1600. Airport 24 Jul 2023 18:06
I also checked abs(ds) < eps , then t = -b/(2*a)

Without it, it was WA3