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 1489. Points on a Parallelepiped

I do simple check to what part does the point below. What's wrong? WA#6. Some tricky tests? Thanks (-)
Posted by Alexey 15 Oct 2006 11:23


Edited by author 15.10.2006 11:24
Re: I do simple check to what part does the point below. What's wrong? WA#6. Some tricky tests? Thanks (-)
Posted by Olympic Bear 15 Oct 2006 16:06
Check each region by x and y, e.g.
if (b+c<=y && y<=b+c+b && c <= x && x<=c+a) // bottom region
Thanks. Now I have WA#7 )
Posted by Alexey 15 Oct 2006 18:59
I had some mistakes like
If y>=a+b+c ...
but must be
If y>=b+b+c

I have one check per one side.
For example
If y<=b - the point is on the lowest side (on the picture).
If x<=c - the point is on the leftest side.
etc.

So, it is enough to check, you see, but WA#7.

Thanks for help but still need it. )
Re: Thanks. Now I have WA#7 )
Posted by Tolstiy_BSU 18 Oct 2006 14:38
You need check
y > b+b+c and y < b+c..

because when point on the edge .... You can do mistake ...
(I was wrong in this)
Re: Thanks. Now I have WA#7 )
Posted by Alexey 18 Oct 2006 21:28
I have AC, so thank U very much!
But I still don't understand my mistake.
It is guaranted that the point is in the picture, so
I can only check one coordinate...

Cann't understand...
Re: Thanks. Now I have WA#7 )
Posted by Midnight_Kitty 27 Nov 2006 01:11
be careful when you do checks like
  if (x <= a) then ...
it can produce WA, becouse if x = a, point can lie on another side
Re: Thanks. Now I have WA#7 )
Posted by Paul Diac 21 Sep 2007 02:23
Yes, that is true.
Thank you.
The test that makes the difference is:
-------
2 2 2
0 4
4 0
-------
before this correction the answer was 4.8989794856 (wrong!)
but the right answer is 2.8284271247 (verifyed with AC program).
Re: Thanks. Now I have WA#7 )
This is great test. Thank you!
Re: Thanks. Now I have WA#7 )
Posted by Partisan 26 Jun 2009 17:40
If you use real numbers, you can get situation, when point lies on none of 6 sides. So you should work with epsilon. Or you can use exact arithmetic, just multiply numbers by 100!



It means 100 and !, not 100! :)

Edited by author 26.06.2009 17:41
no mes
Posted by SuperLight 26 Jun 2009 19:31
Re: Thanks. Now I have WA#7 )
Posted by sergovoy 30 Oct 2017 01:20
TY, Paul Diac!

Edited by author 30.10.2017 01:21