J |
Magnetic
Train Tracks Input: Standard Input Output: Standard Output |
The rail roads of
All the trains move in clockwise or counter clockwise order in a closed triangular track. These triangular tracks can be formed by connecting any three stations in clockwise or counterclockwise order. For simplicity you can assume that a station is denoted by a point in a two dimensional Cartesian Coordinate system. But these triangular tracks and ticket pricing policy can create new troubles. As the ticket price between two stations is proportional to the square of the distance, people often avoid the shortest route to destination and rather choose the longer one through another station. This causes more electricity expense per passenger and creates unwanted crowd in the stations. So the government would prefer not to make such tracks.
Figure 1: The figure above shows 6 places.
It also shows all possible triangular tracks (not necessarily valid site) by
connecting them. The green track is one invalid track site, on the other hand
the red track is one valid track site. There are five other valid track sites
in the above figure. fv |
For example in the figure on the left you can see a closed triangular track marked with green. If someone wants to go from station D to station E he can go directly by riding a clockwise train or can go via station C by riding a counter clockwise train: That is he first buys ticket from station D to C and then he buys ticket of station C to E. But in the current ticket pricing system the route via C (which is also much longer) will be cheaper. So this site CED is not a place to build a track. For the similar reasons AEB is a valid site for building track. On a valid track the shortest distance between any two stations is also the unique cheapest route between them. Given the coordinate of all stations you will have to find the number of sites (a group of three places) for valid tracks.
The input file contains at most 15 sets of inputs. The description of each set is given below:
Each set starts with an n (2<n<1201) which denotes the number of stations. Each of the next n lines contains two integer xi, yi (0≤xi, yi≤10000) which denotes the Cartesian coordinate of the i-th station. You can assume that a track can be built via through any three stations, no three places will be collinear to avoid the problem of degenerate tracks and the connecting railroad between two stations can always be represented by the straight line connecting them.
6 26 23 51 94 103 110 164 107 116 67 73 16 2 1 1 2 2 0 |
Scenario 1: There are 6 sites for
making valid tracks Scenario 2: There are 0 sites for
making valid tracks |
Problem setter: Shahriar Manzoor, Special Thanks: Derek Kisman