ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1489. Точки на параллелепипеде

I do simple check to what part does the point below. What's wrong? WA#6. Some tricky tests? Thanks (-)
Послано Alexey 15 окт 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 (-)
Послано Olympic Bear 15 окт 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 )
Послано Alexey 15 окт 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 )
Послано Tolstiy_BSU 18 окт 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 )
Послано Alexey 18 окт 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 )
Послано Midnight_Kitty 27 ноя 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 )
Послано Paul Diac 21 сен 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 )
Послано Partisan 26 июн 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
Послано SuperLight 26 июн 2009 19:31
Re: Thanks. Now I have WA#7 )
Послано sergovoy 30 окт 2017 01:20
TY, Paul Diac!

Edited by author 30.10.2017 01:21