시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 30 | 11 | 7 | 46.667% |
A group of computer science students arrive in Athens for summer vacation. While thinking of fun ways to explore the Aegean sea by sailing, they came up with the following game:
Your task is the following: given the coordinates of each island and the assigned points, find the ratio R of the optimal route for the sailing cruise.
Let us assume that there are six islands, named A through F, located as shown in the following figure. For example, the coordinates of island B are (4, 2) and its associated points are 6.
The following three figures show three possible sailing routes, starting from Piraeus and returning there. Below each figure is the corresponding ratio R. Among these three, the leftmost route has the highest ratio R of collected points over total distance. Notice that in the rightmost route, the sailing team collects the points of island E - which is located inside the area covered by the cruise.
$R = \frac{5+6+2}{2+\sqrt{8}+2+\sqrt{32}} \simeq 1.041226$ | $R = \frac{2+5+6}{\sqrt{32}+\sqrt{5}+\sqrt{2}+\sqrt{17}} \simeq 0.967965$ | $R = \frac{2+5+6}{\sqrt{32}+3+\sqrt{17}} \simeq 1.017218$ |
Also, notice that the routes P, B, E, C, F, E, P and P, B, F, C, P are not legal, because then the team would pass twice through the same point (island E and the intersection of BF and CP, respectively).
The first line of the input will contain a positive integer N: the number of islands. Each of the following N lines will contain three integer numbers Xi, Yi, Pi: the coordinates (Xi, Yi) of the i-th island and the assigned points Pi. There will not be two islands with the same coordinates.
The output will contain a single line with a single real number: the ratio of the optimalsailing route. The number that you will print must not differ from the actual optimal ratio by more than 10-6.
In all subtasks, it will be 0 < Xi ≤ 10,000, -10,000 ≤ Yi ≤ 10,000, 0 ≤ Pi ≤ 10,000.
번호 | 배점 | 제한 |
---|---|---|
1 | 21 | 1 ≤ N ≤ 20 |
2 | 37 | 1 ≤ N ≤ 100 |
3 | 42 | 1 ≤ N ≤ 2 000 |
6 2 0 5 4 2 6 4 4 2 2 6 1 2 3 5 1 4 6
1.751999