## APIO '10 P3 - Signaling

View as PDF

Points: 25 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem type

A telecom company is developing a GSM network in the city of Beijing. There are houses in the city that need to be covered by the network. Due to budget constraints, the company can install only a single antenna.

To simplify the placement of this antenna, the location will be determined by picking 3 of the houses to make a circle and then placing the antenna at the center of this circle. The range of the antenna will be such that all houses that lie within this circle, including those on the boundary of the circle, are covered.

The company plans to pick the 3 houses at random, so they want to compute the average number of houses that will be covered across all possible choices for the location of the antenna.

For example, suppose there are 4 houses, , , and located as shown in the figure below.

If we choose the circle defined by or , every house is covered. If we choose the circle defined by or , the fourth house is not within the circle covered by the antenna. Therefore, the average number of houses covered is .

Your task is to compute the average number of houses covered by the signal, given the locations of the houses. The positions of the houses are given in terms of a 2-dimensional coordinate system in which all houses have integer coordinates. You are guaranteed that no three houses lie on the same line and no four of them lie on the same circle.

#### Input Specification

The first line of input contains a single positive integer , the total number of the houses. This is followed by lines, describing the locations of the houses. For , the coordinates of house are given by a pair of integers and on line of the input, separated by spaces.

#### Output Specification

The output should contain a single real number, the average number of houses that are be covered by the signal. The absolute error of the result should be less than or equal to .

#### Sample Input

4
0 2
4 4
0 0
2 0

#### Sample Output

3.500

#### Explanation for Sample Output

are all considered correct outputs, moreover, are also acceptable.

#### Constraints

• In of the test cases, for , the coordinates of house are both integers such that . No three houses are located on a line and no four houses are located on a circle.
• In of the test cases, .
• In of the test cases, .
• In of the test cases, .

## Comments

• daoboyang41  commented on Oct. 6, 2018, 3:36 p.m. edited

Just passed it in java by submitting 4 times. It would be really nice if java's time limit is set to 2.1 s