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

Обсуждение задачи 1351. Хороший гнусмас – мёртвый гнусмас

Why WA on #4 ??? Please help!
Послано hey, dude! 20 мар 2005 17:30
const
 e = 1e-8;
 o = 50000;
var
 i,n : longint;
 d,x1,y1,x2,y2,x,y : extended;
procedure vvod;
begin
 {assign(input,'1.txt'); reset(input);}
 read(d,x1,y1,x2,y2,n);
 x1 := x1*o; y1 := y1*o;
 x2 := x2*o; y2 := y2*o;
end;
function kill(x,y : extended) : boolean;
begin
 kill := false;
 if ((x*y1-x1*y)*(x*y2-x2*y) < 0) and (sqrt(x*x+y*y)-d < e) then kill := true;
 if (abs(x*y1-x1*y) < e) and (abs(sqrt(x*x+y*y)+sqrt(sqr(x1-x)+sqr(y1-y))-sqrt(x1*x1+y1*y1)) < e)
 and (sqrt(x*x+y*y)-d < e) then kill := true;
 if (abs(x*y2-x2*y) < e) and (abs(sqrt(x*x+y*y)+sqrt(sqr(x2-x)+sqr(y2-y))-sqrt(x2*x2+y2*y2)) < e)
 and (sqrt(x*x+y*y)-d < e) then kill := true;
end;
procedure find;
begin
 for i := 1 to n do
 begin
  read(x,y);
  if kill(x,y) then writeln('YES')
  else writeln('NO');
 end;
end;
procedure vivod;
begin
 {NOTHING}
end;
begin
 vvod;
 find;
 vivod;
end.
Re: Why WA on #4 ??? Please help!
Послано Smoke 23 мар 2005 23:35
I do not Why but I have WA in #4 test to. I think i have WA when gnumus in 4 chetvert and avtomat can fire in 1 chetvert.
Re: Why WA on #4 ??? Please help!
Послано Cybernetics Team 24 мар 2005 02:28
how did you managed it? I have WA #4 too...
Re: Why WA on #4 ??? Please help!
Послано Smoke 24 мар 2005 15:10
I do not understand why I have WA on #4. Please, who get AC, give me some tests!!!

Edited by author 24.03.2005 15:12
For all who have WA on #4 :-)
Послано hey, dude! 25 мар 2005 00:08
First my solution gives WA on such test :
5 1 0 0 1
1
-1 -1
My prog said that bibr kill gnusmus...

Then I understood that my solution was wrong and wrote a new one. Now I check :
1) if we go from first vector (right frontier of fire) to vector of gnusmus and to left frontier in counterclockwise order.
2) if we go from second vector (left frontier of fire) to vector of gnusmus and to right frontier in clockwise order.

If this two things are true then gnusmus is in the sector of fire => writeln('YES')

That is all :-). Here is a code :

[code deleted]

Edited by moderator 03.12.2019 21:37
try this test (+)
Послано Korduban [Kiev] 27 мар 2005 20:51
---input
2 -30000 -1 30000 0
8
-1 0
-1 1
0 1
1 1
1 0
1 -1
0 -1
-1 -1

---output
NO
NO
NO
NO
YES
YES
YES
YES
Re: try this test (+)
Послано Cybernetics Team 28 мар 2005 14:10
thanks, AC now!
Re: For all who have WA on #4 :-)
Послано Nirjon 19 авг 2005 19:34
I think your solution won't work for the test:

1000 0 5 5 0
1
-1 1

It should be: YES

[your x1*y2-x2*y1 = -25 which makes b1 = false.]
Re: For all who have WA on #4 :-)
Послано Maigo Akisame (maigoakisame@yahoo.com.cn) 10 янв 2006 04:15
I'm afraid this test is illegal
The angle of fire arc in your test is 270 degrees, while the prob states it doesn't exceed 180 degress.
Re: For all who have WA on #4 :-)
Послано Olzhas2dy 22 июн 2007 12:13
Also recommend to try this one
5 0 -5 0 5
1
1 -1
Re: try this test (+)
Послано FireHeart 19 июл 2008 17:48
My output is same. But I have WA#1 (>_<)
Re: try this test (+)
Послано kaa..........ai 19 фев 2016 07:17
Thank you so much!