P29967 [洛谷] [POI 2020/2021 R3] Interplanetary Communication
省选
题目描述

Problem Description

In a two-dimensional plane, there are $n$ points.

For each point, calculate the sum of the Euclidean distances to all other points.

The relative error should not exceed $0.1\%$.

Input Format

The first line contains an integer $n$.

The next $n$ lines each contain two integers $x, y$, representing the coordinates of a point.

Output Format

Output $n$ lines, each containing a real number, representing the answer for each point.

Sample Input and Output

Sample Input #1

4
-1 0
0 0
3 3
-1 1

Sample Output #1

7.000000000000
6.656854249492
13.714776642119
6.886349517373

Sample Input #2

25
-2 -2
-2 -1
-2 0
-2 1
-2 2
-1 -2
-1 -1
-1 0
-1 1
-1 2
0 -2
0 -1
0 0
0 1
0 2
1 -2
1 -1
1 0
1 1
1 2
2 -2
2 -1
2 0
2 1
2 2

Sample Output #2

79.340412611230
68.023981606779
64.155694316737
68.023981606779
79.340412611230
68.023981606779
55.532407162959
51.265774235248
55.532407162959
68.023981606779
64.155694316737
51.265774235248
46.859106568475
51.265774235248
64.155694316737
68.023981606779
55.532407162958
51.265774235248
55.532407162959
68.023981606779
79.340412611230
68.023981606779
64.155694316737
68.023981606779
79.340412611230

Sample Input #3

See attachment

Sample Output #3

See attachment

Notes/Hints

For all data, $2 \leq n \leq 100000$, $-10^6 \leq x, y \leq 10^6$.

Subtask Number Additional Constraints Score
1 $n \leq 1000$ 4
2 All points are collinear 16
3 Coordinates of points are random, relative error not exceeding $2\%$ is acceptable 20
4 60
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 -1 0 0 0 3 3 -1 1
样例输出
7.000000000000 6.656854249492 13.714776642119 6.886349517373