back to the menu

Flag Counter TopCoder SRM 559 - 900: CircusTents

SRM 559 1 900 CircusTents


Problem Statement

题目简述

n个实心圆,两两没有交集,在第一个圆上找一个点,

使得它到另外一个圆上某个点的最短距离的最小值尽量大,

两个点之间的最短距离是指连接两个点且中途不进入任何一个实心圆内部的路径的长度的最小值。

The circus is in town. Actually, several different circuses are in town at the same time. This can get confusing for anyone who tries to wait in line for one of the circuses.

All circuses are standing on a large meadow on the edge of the town. Each circus is inside a single big tent. The base of each tent has the shape of a circle.

You were hired by the owner of one of the circuses. The owner wants to place a ticket booth somewhere on the edge of his circus tent. The ticket booth is small, so for the purpose of this problem we will consider it to be a point on the circle that represents the base of the tent.

Often, there is a long queue for the ticket booth. The placement of the queue is completely unpredictable. Sometimes a bad situation may occur: the queue may reach the tent of some other circus. This confuses the people, so the circus owner wants to prevent such bad situations.



Given a location of the ticket booth, its remoteness is the shortest walking distance from the ticket booth to some point on the boundary of a different circus tent. (That is, the length of the shortest curve that does not pass through any of the circles and connects the ticket booth point to a point on one of the other circles.)

You are given three int[]s: x, y, and r. For each i, there is a circus tent with center at coordinates (x[i], y[i]) and radius r[i]. All the tents are pairwise disjoint. Element 0 of x, y, and r corresponds to the tent that needs the ticket booth. Find the placement of the ticket booth that maximizes its remoteness and return the maximal possible remoteness.

Definition

(be sure your method is public)

Limits

Notes

Constraints

Test cases

  1. input
    • x { 0, 3 }
    • y { 0, 0 }
    • r { 1, 1 }
    output
    Returns 3.7390603609952078
    note
    There is only one optimal placement of the ticket booth: (-1,0).
  2. input
    • x { 0, 3, -3, 3, -3 }
    • y { 0, 3, 3, -3, -3 }
    • r { 1, 1, 1, 1, 1 }
    output
    Returns 2.6055512754639887
    note
    There are four optimal ticket booth locations: (-1,0), (1,0), (0,1), and (0,-1).
  3. input
    • x { 3, 7, 7, 7, 3 }
    • y { 4, 6, 1, -3, 0 }
    • r { 2, 2, 2, 1, 1 }
    output
    Returns 4.3264459099620725
  4. input
    • x { 10, -1 }
    • y { 0, 0 }
    • r { 8, 2 }
    output
    Returns 24.63092458664212
  5. input
    • x { 0, 4, -4 }
    • y { 0, 4, -4 }
    • r { 1, 1, 1 }
    output
    Returns 4.745474963675133

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.