10011 - Where Can You Hide?

All about problems in Volume 100. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

10011 - Where Can You Hide?

Post by Adrian Kuegel » Wed Apr 03, 2002 11:29 pm

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.

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:

Post by Stefan Pochmann » Thu Apr 04, 2002 6:24 am

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.

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel » Thu Apr 04, 2002 12:20 pm

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

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:

Post by Stefan Pochmann » Fri Apr 05, 2002 12:36 am

Those values are correct.

hburch
New poster
Posts: 3
Joined: Wed Apr 10, 2002 7:33 am

Problem #10011: Where Can You Hide?

Post by hburch » Wed Apr 10, 2002 7:57 am

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

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel » Wed Apr 10, 2002 10:01 am

Yes, that is the output that my program prints,too. But I think I have a precision error.

SnapDragon
Problemsetter
Posts: 22
Joined: Tue Jun 11, 2002 12:35 am

Post by SnapDragon » Fri Jun 14, 2002 8:25 am

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.

Even
Learning poster
Posts: 75
Joined: Thu Nov 22, 2001 2:00 am
Location: Taiwan

Post by Even » Sun Nov 03, 2002 11:02 am

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

hekacyr
New poster
Posts: 7
Joined: Sat Oct 19, 2002 1:25 pm

10011 - where can you hide? - rounding problems?

Post by hekacyr » Sat Aug 23, 2003 10:12 pm

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

hekacyr
New poster
Posts: 7
Joined: Sat Oct 19, 2002 1:25 pm

solved

Post by hekacyr » Tue Aug 26, 2003 1:13 pm

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

wenzhi cai
New poster
Posts: 9
Joined: Sat Jun 29, 2002 10:59 am
Location: china
Contact:

Post by wenzhi cai » Wed Sep 03, 2003 2:48 pm

Can anyone tell me why the sample output should be 2.400
with input 5 5 1 12 12 :(

hekacyr
New poster
Posts: 7
Joined: Sat Oct 19, 2002 1:25 pm

Post by hekacyr » Wed Sep 03, 2003 3:16 pm

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

wenzhi cai
New poster
Posts: 9
Joined: Sat Jun 29, 2002 10:59 am
Location: china
Contact:

Post by wenzhi cai » Wed Sep 03, 2003 5:49 pm

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?

hekacyr
New poster
Posts: 7
Joined: Sat Oct 19, 2002 1:25 pm

Post by hekacyr » Wed Sep 03, 2003 6:09 pm

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

wenzhi cai
New poster
Posts: 9
Joined: Sat Jun 29, 2002 10:59 am
Location: china
Contact:

Post by wenzhi cai » Wed Sep 03, 2003 6:24 pm

Well , I know what you mean now :D.
Thank you very much :wink:

Post Reply

Return to “Volume 100 (10000-10099)”