Page 1 of 4

10011 - Where Can You Hide?

Posted: Wed Apr 03, 2002 11:29 pm
by Adrian Kuegel
I'm always getting Wrong Answer and don't know the reason. I calculate the distance from the house to both of the tangents of the tree. If the house lies between the tangents, I output the smaller value for the distance. In other cases I print 0.000. I have also tested my program with the special case r=0 (I print 0.000). Please help me.

Posted: Thu Apr 04, 2002 6:24 am
by Stefan Pochmann
If I remember right, then it can be that the house is placed in front of the tree. Or was it that the tree blocks the path so that you have to take the distance house-tree into account? Really don't remember, sorry.

Posted: Thu Apr 04, 2002 12:20 pm
by Adrian Kuegel
Thanks for your reply. I have inserted the code for these cases, but I still get wrong answer.
Can someone tell me the output for:
4
5 5 5 0.1 6.42
5 5 5 0.1 5.998
5 5 5 0.0005 10
20 -24 6 25 -30
My program prints:
0.100
0.001
0.000
1.810

Posted: Fri Apr 05, 2002 12:36 am
by Stefan Pochmann
Those values are correct.

Problem #10011: Where Can You Hide?

Posted: Wed Apr 10, 2002 7:57 am
by hburch
Although the problem is extremely sketchy on this (IMO), not only must you not be able to walk outside of the tree shade within the distance you give, you must not be able to walk into the tree (at least that was what I did in order to get AC).

Thus: 5 5 5 11 5
has an output of: 1.000

Posted: Wed Apr 10, 2002 10:01 am
by Adrian Kuegel
Yes, that is the output that my program prints,too. But I think I have a precision error.

Posted: Fri Jun 14, 2002 8:25 am
by SnapDragon
You can't forget the case where the house is in front of the tree! Check the distance from the origin to the house. If it's less than the length of the tangent from the origin to the circle, print 0.000.

Posted: Sun Nov 03, 2002 11:02 am
by Even
Adrian Kuegel wrote:Thanks for your reply. I have inserted the code for these cases, but I still get wrong answer.
Can someone tell me the output for:
4
5 5 5 0.1 6.42
5 5 5 0.1 5.998
5 5 5 0.0005 10
20 -24 6 25 -30
My program prints:
0.100
0.001
0.000
1.810
My program ( AC ) output ...

0.100
0.001
0.001
1.810

and the problem says that output the "furthest" distance..
and then sample gives the "nearest" distance ... :o

10011 - where can you hide? - rounding problems?

Posted: Sat Aug 23, 2003 10:12 pm
by hekacyr
hi!

i've solved that problem, but it's really strange. i got a short solution without trigonometric functions. only '*', '/' and sqrt. but if i just store some values (as distance from origin to treecenter) in a variable, instead of recalculating every time it's used, i get WA.

i can't even think of a cause for this behaviour. (or what does the compiler optimize there)

is there a problemsetter, to whom i could send the code?

ciao
-justus

ps: it's not much increase in speed, but i really like to understand what's happening

solved

Posted: Tue Aug 26, 2003 1:13 pm
by hekacyr
ok i found out, what the problem was.

in my first version the compiler let the values in the fpu registers (so with 80bits) in the other version i stored the values in doubles and so lost the precision. if i use long doubles i get AC for this version to.

so everybody might try to use long doubles for this problem.

ciao
-justus

Posted: Wed Sep 03, 2003 2:48 pm
by wenzhi cai
Can anyone tell me why the sample output should be 2.400
with input 5 5 1 12 12 :(

Posted: Wed Sep 03, 2003 3:16 pm
by hekacyr
wenzhi cai wrote:Can anyone tell me why the sample output should be 2.400
with input 5 5 1 12 12 :(
in this case the distance from the house to left tangent (tangent from origin to tree) and to right tangent equals 2.4 and is smaller than the distance to the tree.

-justus

Posted: Wed Sep 03, 2003 5:49 pm
by wenzhi cai
what is the meaning of maximum safe travel distance?
if the distance from origin to right tangent is smaller than the distance
from origin to left,which should I output?

Posted: Wed Sep 03, 2003 6:09 pm
by hekacyr
wenzhi cai wrote:what is the meaning of maximum safe travel distance?
if the distance from origin to right tangent is smaller than the distance
from origin to left,which should I output?
its the max length you can go from your house in a straight line without hitting the radiation no matter which direction you choose. -> min of your distances

-justus

Posted: Wed Sep 03, 2003 6:24 pm
by wenzhi cai
Well , I know what you mean now :D.
Thank you very much :wink: