本站作为LDUOnlineJudge的测试版本进行演示,官方网站请访问http://icpc.ldu.edu.cn
[Hidden]

1228. H. In the Spotlight


Description

Starlet Stacie always insists that the spotlights must shine upon her sufficiently, regardless of where she stands on the stage. Otherwise, she makes a scene.

Consider the floor of the stage to be a Cartesian plane, the front of the stage is the x-axis and the sides of the stage are at x=0 and x=xmax, with the y-axis going toward the back of the stage.

H-1.PNG

So Stacie's stage position is always 0<x<xmax and 0<y<ymax The spotlights are all mounted along the x-axis, and are all aimed onto the stage (parallel to the y-axis), though they might have different focus angles. Height above the stage floor isn't important, so we need to consider only the 2-dimensional plane.

The focus angle of each spotlight is an angle relative to the aimed direction, on either side, and indicates the area covered by that light beam. Thus each spotlight will essentially cover a stage area that is an isosceles triangle (with the back of the stage as the 3rd side).

H-2.PNG

Anything outside a spotlight's triangular coverage area gets negligible illumination. The intensity of a light within the triangle (any point within .01 degrees of the focus angle is considered inside the triangle) is given by Isource÷d2 where Isource is the intensity of the light at its source point, and  is the distance from the source point.

If Stacie is standing within the coverage area of more than one light, the total intensity of light shining on her is simply the sum of all such lights.

The Problem:

Given Stacie's stage position and the positions and intensities of various spotlights during a scene, find the intensity of light shining on Stacie.

Input

The first line of input will contain only a positive integer p, which is the number of scenes to evaluate. This will be followed by p scene descriptions. The first line of each scene description will contain three integers, xs and ys(0<xS,yS<1000), representing Stacie's position, and n(0<n<100), the number of lights that are turned on. The second line will contain n distinct non-negative integers less than 1000: α1,α2,... αn; these are the positions of the lights along the x-axis. (Note that distance units are not provided because all distance units are the same.) The third line will contain nn positive integers less than 90: a1,a2,... an; these are the focus angles, in degrees, for each corresponding light on the preceding line. The fourth line of each scene description contains n positive integers less than 10,000: I1,I2,... In; these are the intensities of the lights at their source points for each corresponding light on the preceding lines. All numbers on the same line will be separated from each other by exactly one space, with no leading or trailing spaces. (Use 3.14159265 for the value of π.)

Output

For each scene description, output a message of the form

Scene #s: Spotlight intensity on Stacie is t

where ss is the number of the scene in the input (counting from 1) and tt is the total light intensity, rounded to the nearest three decimal places (examples: 1.2374 would round to 1.237 and 1.2375 would round to 1.238).

Leave a blank line after the output for each data set. Follow the format illustrated in Sample Output.

Samples

Input Copy
2
5 5 3
0 5 10
50 45 40
100 100 100
10 2 2
10 40
15 5
400 500
Output
Scene #1: Spotlight intensity on Stacie is 6.000

Scene #2: Spotlight intensity on Stacie is 100.000

Source

UCF Practice 2013
Problem Information

Time Limit: 1000MS (C/C++,Others×2)
Memory Limit: 256MB (C/C++,Others×2)
Special Judge: No
AC/Submit: 1 / 1
Tags:
Contests involved

1026. UCF 2013 Practice
My history solutions

You didn't submit any solution!
Submit your solution

Login Register