Problem C
Sneak Attack

You are in a game of laser tag, where the goal is to shoot and hit other players with the laser gun you are carrying. Running up to them and shooting sometimes works, but it leaves you more vulnerable to their counterattack than you would like. You have found that you can be sneakier if you bounce your shot off of a mirror before it hits them. This allows you to shoot around a corner, for example.

To practice your shots, you shoot at a wall (the target) by reflecting your shot off of a mirror. Write a program that tells you where on the target wall your laser would strike when shooting from different locations. The wall is considered to be infinitely long at $x=0$.

\includegraphics[width=0.3\textwidth ]{shooting}


Input consists of up to $1\, 500$ test cases. Each test case consists of six space-separated real values, $x_1~ y_1~ x_2~ y_2~ x_3~ y_3$. The first four numbers represent the endpoints of the mirror, and the last two represent your position. You can be sure that $x_1 \neq x_2$, or $y_1 \neq y_2$, or both. You can also be sure that $x_1\cdot x_2>0$. You are not standing on the mirror. All coordinates are in the range $[-100,100]$ with at most $5$ digits past the decimal point. Input ends at end of file.


For each test case, report the $y$-coordinates of the range of locations on the wall that you can hit if you shoot at the mirror. Hitting either side of the (infinitely thin) wall is considered a hit. Report the coordinates from least to greatest. If you can hit an infinitely-long section of the wall, use the terms negative-infinity or positive-infinity as appropriate. Ignore any potential occlusions, such as the laser hitting you, or the laser hitting the wall before getting to the mirror. Numeric answers should be accurate to within $0.0001$ units. If you can’t hit the wall at all, output can't hit the wall.

Sample Input 1 Sample Output 1
5 10 10 10 10 0
5 10 10 5 10 0
6 10 10 10 10 0
negative-infinity 0
5 12.5
negative-infinity -5
Sample Input 2 Sample Output 2
10 10 20 20 20 10
can't hit the wall

Please log in to submit a solution to this problem

Log in