Do not fight with precision, use fractions in Python 3. BTW: I have used selfimplemented highprecision longint to solve this problem. 1000 0 0 1000 0 0 1000 1000 VISIBLE 1000 0.000001 0 1000 0 0 1000 1000 INVISIBLE 1000 0 0.000001 1000 0 0 1000 1000 INVISIBLE 1000 0 0.000001 1000 0 0 1000 1000 VISIBLE 1000 0.000001 0.000001 1000 0 0 1000 1000 VISIBLE 1000 1000 999.999999 1000 0 0 1000 1000 INVISIBLE 1000 1000 999.999999 999.999999 0 0 1000 1000 VISIBLE 999.999999 1000 1000 999.999999 0 0 1000 1000 VISIBLE 1 2 1 0 0 0 0 1 VISIBLE 1.000001 2 1 0 0 0 0 1 VISIBLE 0.999999 2 1 0 0 0 0 1 INVISIBLE 1000 0 1000 0.000001 0 0 0.000001 1000 VISIBLE 1000 0 1000 0.000002 0 0 0.000001 1000 VISIBLE 1000 0 1000 0.000003 0 0 0.000001 1000 INVISIBLE 2 more test which help me get AC, I fails on checking that both points on 1 side of line. 40 60 59 40 50 30 90 70 VISIBLE 40 60 61 40 50 30 90 70 INVISIBLE i dont understand this in 2d space what about z coordinate plz help What answer on this test? 0 3 1 1 1 0 3 0 Edited by author 04.01.2009 19:53 On C++ with double I got WA 9, on Pascal with extended  WA 4, but on Pascal with double  WA 11. Why??? Edited by author 04.01.2009 19:55 I DID IT!!! It's my 200'th problem)) And how I have 666 rank =))))  Preamble. I've just solved this problem in C# using only Double type (64bit floating point) and using only operations: +,  and *. My method also can be used with only integer numbers. But in that way you'll need to code 128bit signed integer type. You have 4 points: "the banker’s eye" [name it Eye], "the victim" [name it Victim], "first mirror coordinate" [name it Mirror1], "second mirror coordinate" [name it Mirror2]. At first you should check whether Eye and Victim are in one halfplane relative to the mirror line. If they are not, then answer is INVISIBLE. And now starting the most interesting part of solution. My first thought was to build mirrored lines of sight (first: see from Eye, refraction point is Mirror1; and second: see from Eye, refraction point is Mirror2) ans check whether Victim is between that mirrored lines of sight. But it requires more precision than double can offer. And then I understand that there's another way to solve that problem!! Hint1: Build an equation, that depends of Eye, Victim, Mirror1, Mirror2, and RefractionPoint. The last parameter is some point on the line formed by Mirror1 and Mirro2 points. This equation must be true if the angle of incidence (between Eye and mirror) equals to the angle of reflection (between Victim and mirror) in RefractionPoint. The only operation you need is +, , * and /. But if you dispose of division and move all to the left side of the equation you'll get a function that equals to 0 when the angle of incidence equals to the angle of reflection in RefractionPoint and not equal to 0 otherwise. Hint2: The fact about that function: the sign of its returning value can say you a direction where to find that point. And the last hint: The jury do not ask you to find the refraction point =) They only ask you to determine if Victim is seen from Eye (!!!!). In other words "is there exists a RefractionPoint between Mirror1 and Mirror2 that function we've built equals to 0 in that point?" Well, I think it is enough to solve this problem =)) Edited by author 20.07.2011 03:15 I have only ONE division and no sqrt's, no rotates! what's wrong? Try rewrite program on pascal with extended. I got wa9 on C++ too, but on pascal same algo got AC Edited by author 10.04.2009 12:56 ok, i'll try. but why? i used long double, is that correct? damn, AC! thanks :) sizeof (long double)=sizeof (double) Try to swap(x1,x2) and swap(y1,y2). This change gave me AC. thanks, it's really weird..... In the test #26 banker’s eyes and (x2,y2) points are situited in the opposite sides of the mirror. Answer should be "INVISIBLE". 2 2 0 4 0 0 2 2 ans = INVISIBLE It is not test 3. I get WA3 whith ans INVISIBLE 0 1 2 1 2 0 0 0 answer: visible I think it's terrible problem. I've used diffrent eps to solve it. And than I change it to eps = 0... I couldn't belive my eyes.... It was AC. So, if you have a lot of strange WA's, try not to use eps. Thanks, it really helped me :) There are 2 same solutions (C, Pascal). C solution gets WA, 9 Pascal solution gets AC Why??? Please, give me some hints about it. For example (sizeof(long double) == 8) I thought it's so only in Visual C. GNU C and Borland C compilers use sizeof(long double) = 10. Am I right? Yes. But as far as I know Intel C++ compiler is used there. And in ICL (at least in 8.1) sizeof(long double)==8 Of course! But solution without it is more short and beauty. :) And it's more interesting to solve problem using only Extended. But if juri suppose exact numbers when answer is unequivocal it would be funny try adjust epsheuristics. Next time you would be killed by rejujement. I have Ac using 120digits integers and dotproduct as angle haracteristics. Thus use only +,,*,<,==. My program doesn't use any long arithmetics  only standard Pascal's real (or extended?) type, and it hasn't any problem with accepting this problem. If jury assumed using long arithmetics, then testset is very weak... Could anybody say me how find point, symmetrical to given point relatively some line? Without division... Thanks I'm sorry.... В условии сказано "Гарантируется, что точки (x1, y1) и (x2, y2) не лежат на прямой, проходящей через точки (xm1, ym1) и (xm2, ym2)" Это значит что они одновременно не лежат или одна может лежать а другая нет?... Edited by author 21.01.2006 13:51 It means that each of these points doesn't belong to the line, passing through the points (xm1, ym1) and (xm2, ym2). Then i could not understand how this solution gets WA#23 Const Eps = 1e15; function Eq(a, b : Extended) : boolean; begin Result := Abs(ab) <= 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*(y3y4)*((x3x4)*(y2y3)  (x2x3)*(y3y4))/ ( (x3x4)*(x3x4) + (y3y4)*(y3y4)) + x2; y5 := 2*(x4x3)*((x3x4)*(y2y3)  (x2x3)*(y3y4))/ ( (x3x4)*(x3x4) + (y3y4)*(y3y4)) + y2; A := y1y5; B := x5x1; C := (A*x1+B*y1); A1 := y3y4; B1 := x4y3; 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 At first,I use line equation, I assume perc = 1e6, WA#6... and then prec = 1e12, WA#9...:( It seems that the prec is terrible... Finally, I found that uses vectos with some calculate improvement, it needs only add, sub, mul... Just maths jobs... It can AC easily:) My solutions get WA 8 and WA 13. (It doesn't use long numbers) I'm sure it's so because of precision. If you have solution without long 100digit numbers, send me please to sk1@hotbox.ru I get WA #8 and I suppose it's because of the precision. I tried rotating everything so that the mirror becomes (0,0) > (L,0) actually using sin and cos and got WA #8. I tried finding out the relative coordonates without actually using rotations (using distances) and got WA at even lower tests (4 or 5). Can anybody help me with some hints? Should i try it in pascal with the extended type? Or anybody that got AC in C please help. All calculations can be done in integers. 100digit numbers are quite enough. But don't you need sqrt (and maybe division too)? Or you did those on large numbers as well? I don't need division and sqrt, only addition, subtraction and multiplication. I tried using double and no rotations. Actually the exact operations i did on long nombers and got AC, but on double (only add, sub and mul). It didn't work. Maybe with pascal's extended it does. Maigo Akisame (maigoakisame@yahoo.com.cn) How? [1] // Problem 1265. Mirror 15 Sep 2004 20:15 
