Masala #ZAGVK1OFIP
The last game
Before the start of the NERC 2022 championship, Rafael decided to distract his teammates Shahzod and Akmal. Since they were very nervous, Rafael came up with a game: he drew on a grid notebook 2 * n points with integer coordinates. Shahzoda and Akmal take turns coloring the points: Shahzoda paints them white, and Akmal paints them black. After they color all the points, they count their scores. Each player receives a number of points (a real number) equal to the sum of pairwise distances between the points colored with their color. The winner is the one who scores more points. It is assumed that the players play optimally. You need to output the difference between the number of points of the winner and the loser.
The first line contains a natural number n (1≤n≤500).
The next 2∗n lines contain the coordinates of points (x1,y1),(x2,y2),...,(xn,yn) with integer coordinates, where the absolute value of each coordinate does not exceed \(10^3\).
Print the difference between the number of points of the winner and the loser. The difference in points should be displayed with three digits after the decimal point.
# | input.txt | output.txt |
---|---|---|
1 |
2 0 0 0 1 1 0 1 1 |
0.000 |
2 |
2 0 0 1 0 0 3 1 5 |
1.937 |