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 1265. Mirror

!!!....I have some questions...!!! Please help me....
Posted by ZiV 21 Jan 2006 13:47
I'm sorry....
В условии сказано "Гарантируется, что точки (x1, y1) и (x2, y2) не лежат на прямой, проходящей через точки (xm1, ym1) и (xm2, ym2)" Это значит что они одновременно не лежат или одна может лежать а другая нет?...

Edited by author 21.01.2006 13:51
Re:
Posted by Someone 21 Jan 2006 14:29
It means that each of these points doesn't belong to the line, passing through the points (xm1, ym1) and (xm2, ym2).
help!!!!!
Posted by ZiV 21 Jan 2006 14:55
Then i could not understand how this solution gets WA#23
Const
 Eps = 1e-15;
function Eq(a, b : Extended) : boolean;
begin
  Result := Abs(a-b) <= eps;
end;

Function Less(a, b : Extended): boolean;
begin
  Less := Eq(a,b) or ((a - b) <= -eps);
end;

Function Less1(a, b : Extended): boolean;
begin
  Less1 := ((a - b) <= -eps);
end;


Var
 x1,x2,x3,x4,x5,y1,y2,y3,y4,y5 : extended;
 A,B,C,A1,b1,c1 : extended;
BEGIN
 Read(x1,y1);
 Read(x2,y2);
 Read(x3,y3);
 Read(x4,y4);
 x5 := 2*(y3-y4)*((x3-x4)*(y2-y3) - (x2-x3)*(y3-y4))/
       ( (x3-x4)*(x3-x4) + (y3-y4)*(y3-y4)) + x2;
 y5 := 2*(x4-x3)*((x3-x4)*(y2-y3) - (x2-x3)*(y3-y4))/
       ( (x3-x4)*(x3-x4) + (y3-y4)*(y3-y4)) + y2;
 A := y1-y5;
 B := x5-x1;
 C := -(A*x1+B*y1);
 A1 := y3-y4;
 B1 := x4-y3;
 C1 := -(A1*x3 + B1*y3);
 if (Less((A*x4+B*y4+C)*(A*x3+B*y3+C),0)) and ( Less1((a1*x1+b1*y1+c1)*(a1*x5+b1*y5+c1),0)) then
  Writeln('VISIBLE')
 Else
  Writeln('INVISIBLE');
END.

Edited by author 21.01.2006 19:32