|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Автор: Павел Кузнецов, ПГУ.
Сложность Гамма
N multicolored lights are given on a plane. A light is specified by the
coordinates of the point of its location, by the coordinates of the point
it is directed at and by the angle of lighting. The light is considered
to be directed at the point if and only if the point is located inside
the angle of lighting and the line connecting the light with the point is
the bisector of that angle. Each light has its own color which is specified
by three integers within the range from 0 to 255 (the RGB system).
It is in this color that light illuminates the angle on the plane.
In case the point lies inside or on the border of the lighting angle
with the color (R, G, B) and is located at distance
d from it, the given light colors the point in the color
([R/(1+sqrt(d))], [G/(1+sqrt(d))], [B/(1+sqrt(d))]),
i.e. each color component becomes 1+sqrt(d) times less. Here the
sqrt(d) is the square root of the number d, and [x] denotes the
integer part of x, i.e. the largest integer not exceeding x.
If a certain point on the plane is colored by several lights at the
same time its color is the arithmetic average of all the colors.
The point which not illuminated by any light is black, i.e. its color
is (0, 0, 0).
You have been given the descriptions of N lights and the
coordinates of the point. Your task is to define the color of the point.
Input
The first line of the input contains an integer N (1 ≤ N ≤ 1000).
Then there must be N lines describing the lights. Each light is
determined by eight integers: X1, Y1
(coordinates of the light), X2, Y2
(coordinates of the point it is directed at), A (angle of lighting
in degrees), R, G, B (color). The last line
contains the coordinates of the point for which you are to determine the
color. It is provided that all the coordinates modulo do not exceed 1000,
and the angle of lighting is between 1 and 180 inclusive.
Output
The output should represent the color of the point in question, giving
three integers R, G, B with spaces.
Input 1
|
Output 1
|
2
0 0 1 1 90 255 0 0
-2 -2 1 1 90 0 255 0
-1 -1
|
0 116 0
|
Comment on the example: the point gets under the second light and
is at the sqrt(2) distance from it.
Для отправки решений необходимо выполнить вход.
|