#P10336. [UESTCPC 2024] 2-聚类算法
[UESTCPC 2024] 2-聚类算法
Problem Description
Alice and Bob are two creatures in a -dimensional space. In the space they live in, there are feature points. The coordinates of the -th feature point are .
In this space, the distance between two points is defined as the Manhattan distance between them (that is, the distance between point and point is ).
Alice and Bob need to collect these feature points. They take turns choosing one point from these points, and a point that has already been chosen cannot be chosen again. Alice moves first. Alice puts the points she chooses into set , and Bob puts the points he chooses into set .
Define the value of a set as the sum of distances between every pair of points in it. Alice wants to maximize , while Bob wants to minimize .
If both Alice and Bob use optimal strategies, find the final value of .
Input Format
The first line contains two integers , representing half the number of feature points and the number of dimensions in the space.
The next lines each contain integers , representing the coordinates of the -th feature point.
Output Format
Output one integer, representing the value of when both Alice and Bob use optimal strategies.
“The sum of distances between every pair of points” counts each unordered pair only once.
2 2
1 0
0 1
1 1
0 0
0
Hint
Translated by ChatGPT 5