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 1351. Good Gnusmas – Dead Gnusmas

Why WA on #4 ??? Please help!
Posted by hey, dude! 20 Mar 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!
Posted by Smoke 23 Mar 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!
Posted by Cybernetics Team 24 Mar 2005 02:28
how did you managed it? I have WA #4 too...
Re: Why WA on #4 ??? Please help!
Posted by Smoke 24 Mar 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 :-)
Posted by hey, dude! 25 Mar 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 (+)
Posted by Korduban [Kiev] 27 Mar 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 (+)
Posted by Cybernetics Team 28 Mar 2005 14:10
thanks, AC now!
Re: For all who have WA on #4 :-)
Posted by Nirjon 19 Aug 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 :-)
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 10 Jan 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 :-)
Posted by Olzhas2dy 22 Jun 2007 12:13
Also recommend to try this one
5 0 -5 0 5
1
1 -1
Re: try this test (+)
Posted by FireHeart 19 Jul 2008 17:48
My output is same. But I have WA#1 (>_<)
Re: try this test (+)
Posted by kaa..........ai 19 Feb 2016 07:17
Thank you so much!