Signal
Time limit2sMemory limit128 MB
Given n points with no three collinear and no four concyclic, average over all triples the number of points inside or on the circle through the triple.
- Level
Hard8 of 10
- Topics
- Geometry, Combinatorics, Sorting, Two pointers
- Solved
- No attempts yet
Problem
A telecommunications company is building a GSM (mobile phone) network in Beijing. The network should serve houses in the city, but because of a limited budget the company can build only a single antenna.
The antenna is placed by choosing of the houses and building it at the center of the circle that passes through those three houses. Then every house that lies inside or on the boundary of that circle receives a signal. The company plans to pick the three houses at random, and to estimate how many houses would receive a signal it wants the average, over all possible choices of three houses, of the number of houses that receive a signal.
Your task is: given the positions of the houses, compute the average number of houses that receive a signal. The positions are given as integer coordinates in the plane. No three houses are collinear, and no four houses lie on the boundary of a common circle.
Input
The first line contains a positive integer (), the number of houses. Each of the next lines describes one house: for , line contains two integers and , the coordinates of house , separated by a space.
All coordinates are integers with . No three houses are collinear, and no four houses lie on the boundary of a common circle.
Output
Output the average number of houses that receive a signal, as an exact fraction in lowest terms: if the average equals in lowest terms with , print it as p/q; if the average is an integer, print just that integer.