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 (64-bit 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 128-bit 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 =))
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.
But if juri suppose exact numbers when answer is unequivocal it would be funny try adjust eps-heuristics. Next time you would be killed by rejujement. I have Ac using 120-digits integers and dot-product 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...
I'm sorry.... В условии сказано "Гарантируется, что точки (x1, y1) и (x2, y2) не лежат на прямой, проходящей через точки (xm1, ym1) и (xm2, ym2)" Это значит что они одновременно не лежат или одна может лежать а другая нет?...
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.