Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Connected Gheeves
Description Gheeves (plural of gheef) are some objects similar to funnels. We define a gheef as a two dimensional object specified by a sequence of points ( - 3 ≤
*n*≤ 1000 - If a point
*p*is specified by the coordinates (_{i}*x*,_{i}*y*), there is an index 1 <_{i}*c*<*n*such that*y*>_{1}*y*> ... >_{2}*y*and_{c}*yc*<*y*_{c+1}<*y*_{c+2}< ... <*y*._{n}*p*is called the cusp of the gheef._{c} - For all 1 ≤
*i*<*c*,*x*<_{i}*x*and for all_{c}*c*<*i*≤*n*,*x*>_{i}*x*._{c} - For 1 <
*i*<*c*, the amount of rotation required to rotate*p*around_{i-1}*p*in clockwise direction to become co-linear with_{i}*p*and_{i}*p*, is greater than 180 degrees. Likewise, for_{i+1}*c*<*i*<*n*, the amount of rotation required to rotate*p*around_{i-1}*p*in clockwise rotation to become co-linear with_{i}*p*and_{i}*p*, is greater than 180 degrees._{i+1} - The set of segments joining two consecutive points of the sequence intersect only in their endpoints.
For example, the following figure shows a gheef of six points with We call the sequence of segments ( Q = (q_{1}, q_{2}, ..., q), such that all _{m}x coordinates of p are negative integers and all x coordinates of qi are positive integers. Assuming the cusps of the two gheeves are connected with a narrow pipe, we pour a certain amount of water inside the gheeves. As we pour water, the gheeves are filled upwards according to known physical laws (the level of water in two gheeves remains the same). Note that in the gheef _{i}P, if the level of water reaches min(y_{1}, y), the water pours out of the gheef (the same is true for the gheef _{n}Q). Your program must determine the level of water in the two gheeves after pouring a certain amount of water. Since we have defined our problem in two dimensions, the amount of water is measured in terms of area it fills. Note that the volume of pipe connecting cusps is considered as zero.Input The first number in the input line, y where _{k}k is the number of points in the gheef (n for P and m for Q), and the x _{i}y sequence specify the coordinates of the points in the sequences._{i}Output The output contains Sample Input 2 25 3 -30 10 -20 0 -10 10 3 10 10 20 0 30 10 25 3 -30 -10 -20 -20 -10 -10 3 10 10 20 0 30 10 Sample Output 3.536 -15.000 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator