当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
Mr. X and his friends are great funs of Laser-Ball Game. Basically, the main idea of the game is very simple. Each player of the game has a laser gun and it is necessary to hit an opponent with a laser beam. To make the game more interesting, Mr. X with friends created their own Laser-Ball playground. They rented an empty rectangular hall and set up a number of big mirrors. What makes the game more interesting is the additional ability to shoot into a mirror since that a reflected laser beam also can hit an opponent.
You need to write a program which determines if it is possible to hit an opponent standing in a point B from point A. If such a hit is possible the program needs to give a direction.
To clarify the problem the following rules are given.
The input contains one data set. A data set starts with a line containing two real numbers XB and YB separated by one or more spaces. The next line contains two integer numbers, N and K, separated by one or more spaces. The next N lines contain four real numbers X1i, Y1i, X2i, Y2i each, separated by one or more spaces.
The output contains the word “impossible”, if the shoot is impossible. Otherwise it contains two real numbers a, b, (separated by one space), which give a direction of the shoot.
sample input #1 4.0 0.0 2 1 2 -1 2 1 1 2 3 2 sample input #2 4 0 1 1 1 0 3 0 sample input #3 4 0 1 1 2 -1 2 1
sample output #1 1 1 sample output #2 1 0 sample output #3 impossible
时间上限 | 内存上限 |
3000 | 65536 |