ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Kovrov IT > задача:


2007.E. 50663 - Lights

Гость
• Обсуждение задачи (1)

Задачи сборника

• 2007.A. 50671 - Phalanx
• 2007.B. 50270 - Bitsorting
• 2007.C. 50640 - Cubes
• 2007.D. 50271 - Factorial
• 2007.E. 50663 - Lights
• 2007.F. 50690 - Parliament
• 2007.G. 50272 - Strange Numbers
• 2007.H. 50273 - Two Captains
• 2007.I. 50274 - Boundary Troops
• 2007.J. 50275 - Wedding
• 2007.K. 50276 - Nice Floor
• 2008.A. 50672 - Math and Soldiers
• 2008.B. 50261 - Roads

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 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.

Для отправки решений необходимо выполнить вход.

www.contester.ru