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

Обсуждение задачи 1647. Раздел острова

WA#1
Послано Shteiner, Tyurin, Dergachev 25 окт 2008 17:00
Why? I pass the given tests correctly.

BTW, the problem can have several answers, :S
Re: WA#1
Послано Al.Cash 25 окт 2008 17:48
I had WA#1, then WA#22. Can somebody help me? I think there are problems with precision.
Re: WA#1
Послано Shteiner, Tyurin, Dergachev 25 окт 2008 18:00
Wow, I also have WA#22 now.

BTW, my WA#1 was because I didn't #include <math.h> LOL
Re: WA#1
Послано Al.Cash 25 окт 2008 18:01
AC now)))
Using epsilon in some more places helped me a lot!
Re: WA#1
Послано Chiffa 25 окт 2008 18:02
According formule S=sqrt(p*(p-a)*(p-b)*(p-c)) => the problem has 3 different answers.
Re: WA#1
Послано Al.Cash 25 окт 2008 18:08
No! Sample #2 has only one answer.
Re: WA#1
Послано svr 26 окт 2008 09:52
Yes!Agree.Impossible get Ac without eps.
Epsilon
Послано Aram Shatakhtsyan 27 окт 2008 01:02
Please, who can explain me why epsilon is needed in
problems which contain real numbers, and where should
I use it in this problem? I got WA#22, and can't
understand my mistake.
Re: Epsilon
Послано svr 27 окт 2008 09:44
There are many trick with epsilon.
For example. Let eps=1e-10 and some geometrical
value d calculated as -1.e-11. We reject this
calculation because d must be >=0 and make mistake
lossing d=0. With eps we do it as
if (fabs(d)<=eps) d=0
thus accepting negative -1e-11.
Re: Epsilon
Послано Partisan 3 сен 2009 21:36
When I used eps=1e-13, I got WA #22, and when I chaged it to 1e-10, I got AC.

Here are fragments, where I use eps:

...
double d=p*p-2*a*b;
if(fabs(d)<eps)
...
(d is discriminant of square equation)

...
if(t1>a+eps || t2>b+eps)
    return false;
...
(check that t1<=a and t2<=b).

I can't understand why I had this situation.
Re: Epsilon
Послано Partisan 5 сен 2009 01:08
Maybe the numbers are big, so adding 1e-13 is equal to adding 0.
Re: Epsilon
Послано timus__dimus 30 июл 2011 02:05
eps = 1e-10
thanks!

Edited by author 30.07.2011 02:06

Edited by author 30.07.2011 02:06