TVTower
SRM 183 · 2004-02-11 · by brett1479
Problem Statement
We have
Notes
- If the return has either a relative or absolute error less than 1.0E-9 it is acceptable.
Constraints
- x will contain between 1 and 50 elements inclusive.
- y will contain the same number of elements as x.
- Each element in x and y will be between -1000 and 1000 inclusive.
{1, 0, -1, 0}
{0, 1, 0, -1}
Returns: 1.0
By symmetry we should locate the tower at the origin, which is in the center of the diamond formed by these 4 towns.
{3}
{299}
Returns: 0.0
Locate the tower right in the town.
{1000,1000,1000,1000,999}
{500,1000,-300,-989,-300}
Returns: 994.5
{5, 3, -4, 2}
{0, 4, 3, 2}
Returns: 4.743416490252569
{5,-3,-4}
{0,4,-3}
Returns: 5.0
Submissions are judged against all 47 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class TVTower with a public method double minRadius(vector<int> x, vector<int> y) · 47 test cases · 2 s / 256 MB per case