Hide

Problem B
InTents

A circus is constructing their tent. The tent is a large piece of canvas held up by a given number of various length tent poles. The tent poles go in specific places on the ground, but which tent pole goes in which place is up to you. You need to choose a placement for the given tent poles that maximizes the total volume under the tent.

There will always be one central pole at the origin; the other poles are distributed around the periphery. The tent is always drawn tight between the central pole and two adjacent poles on the periphery, forming a perfect triangle. Only the volume under these triangles formed by two adjacent outer poles and the central origin pole counts towards the total volume. Adjacency is by angle around the origin.

Input

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. The first line of input contains an integer $n$ ($3 \le n \le 30$), which is the number of poles.

The next $n-1$ lines each contains two integers $x$ and $y$ ($-1\, 000 \le x, y \le 1\, 000$), representing a 2D coordinate, giving the locations where the poles may be placed. None of these points are at the origin. The locations may not be in order around the origin. After that, there will be $n$ lines, each containing a single integer $h$ ($1 \le h \le 100$). These are the heights of the poles.

One pole must be placed at the origin, and the rest must be placed at the $(x,y)$ coordinates in the input. The $(x,y)$ locations will surround the origin; that is, the polygon formed by the $(x,y)$ locations, in order (by angle around the origin), will strictly include the origin. No two holes will be at the same angle with the origin (i.e. no triangle of roof fabric will have area $0$).

Output

Output a single floating point number, which is the maximum volume achievable under the tent. Your answer will be considered correct if its absolute error does not exceed $10^{-2}$.

Sample Input 1 Sample Output 1
5
100 100
-200 -200
300 -300
-400 400
30
20
50
60
10
8566666.666667

Please log in to submit a solution to this problem

Log in