#P10533. [Opoi 2024] 热核武器
[Opoi 2024] 热核武器
Background
The Flea Kingdom and the Cricket Kingdom are fighting fiercely.
The above is a tactical nuclear graphics card and is not related to the problem.
Problem Description
The territory of the Flea Kingdom can be viewed as a 2D Cartesian coordinate system.
The Flea Kingdom has cities. One city is the capital, located at . The other cities are ordinary cities. Assume the capital is city , and the other cities are numbered from to . For each ordinary city , it is located at .
Due to limited financial resources, for each city that is not the capital, it will choose a city to build a bidirectional road. Let be the Euclidean distance between cities and . Then for each city that is not the capital, the corresponding is the point that minimizes among all points satisfying and . If there are multiple valid , choose the one with the smallest index.
Define the value of a city as (the minimum number of roads needed to travel from this city to the capital) . If the capital cannot be reached, set the value to .
The Cricket Kingdom is going to carry out a tactical nuclear graphics card strike on the Flea Kingdom. This operation is divided into two groups: the Lorentz Group and the Ampere Group. Each group will strike some of the cities, and the two groups must strike each city in the Flea Kingdom exactly once.
For these two groups, fame is the most important, and the Cricket Kingdom’s evaluation standard is the sum of the values of the cities struck in this operation. So you need to determine whether there exists a partition such that the sums of values of the cities struck by the Lorentz Group and the Ampere Group are equal. If yes, output Yes, otherwise output No.
Input Format
The first line contains an integer , representing the number of ordinary cities in the Flea Kingdom.
The next lines (lines to ): the -th line contains two integers, representing the coordinates of city .
Output Format
Output one string in a single line, Yes or No, indicating whether there exists a way to make the sums of values of the cities struck by the Lorentz Group and the Ampere Group equal.
4
-1 -1
1 0
1 -2
-2 2
Yes
Hint
Sample Explanation
This figure looks like this:

For : both and satisfy , but is closer to , so add the edge .
For : only satisfies , so add the edge .
For : the three points , , and satisfy , but is closest to , so add the edge . Note that this is because when considering , the optimal point is , so builds a road to , which is completely independent of the road .
For : all other points satisfy , but is closest to , so add the edge .
We obtain the following table:
| City Index | Value |
|---|---|
So assign to the Lorentz Group, and assign to the Ampere Group.
Constraints
, .
Special Note
Since the output of this problem is only Yes or No, this problem uses the minimum-score judging method, i.e., the minimum score among all test points is taken as the final result.
Translated by ChatGPT 5