Hide
Problem D
Tram

A tram with a very low unusefulness. Maybe Lund’s tram line
will be as appreciated as Istanbul’s, one day.
Photographer: Maj Stenmark
The politicians have already decided that the tram line should run from south-east to north-west. In order not to cause too many complaints from the citizens, they want to make the line as useful as possible. Therefore they want to minimize the total unusefulness of the tram.
The unusefulness for citizen
Given the coordinates of each citizen’s home, determine the value
Input
The first line of input consists of an integer,
Output
The output consists of a single number,
Sample Input 1 | Sample Output 1 |
---|---|
3 1 1 2 2 3 3 |
0.000000 |
Sample Input 2 | Sample Output 2 |
---|---|
3 0 1 1 0 1 1 |
0.000000 |
Sample Input 3 | Sample Output 3 |
---|---|
3 0 2 1 1 1 0 |
0.333333 |