#P10533. Equal Gamma Sum Partition

    ID: 12551 Type: Default 1000ms 256MiB

Equal Gamma Sum Partition

Equal Gamma Sum Partition

Flea Nation can be represented on a Cartesian plane. There are (N+1) cities: one capital located at ((0,0)) (city 0) and (N) other cities numbered from 1 to (N) with coordinates ((x_i,y_i)). For each non‐capital city (i), a bidirectional road is built to a city (j) chosen by the following rule:

Among all cities (other than (i)) satisfying [ \operatorname{dis}(j,0)\le \operatorname{dis}(i,0), ] where (\operatorname{dis}(a,b)) denotes the Euclidean distance between cities (a) and (b), city (j) is chosen so that the distance (\operatorname{dis}(i,j)) is minimized. In case of ties, the city with the smallest index is chosen.

The (\gamma) value for a city is defined as the minimum number of roads needed to reach the capital plus 1. (If the capital is unreachable, (\gamma=0).)

Fleas have been provided with a tactical strike plan divided into two teams: the Lorenz team and the Ampere team. They must partition all cities (each city is struck exactly once) so that the sum of (\gamma) values of the cities attacked by each team is equal. Your task is to determine whether such a partition exists. If yes, output “Yes”; otherwise, output “No".

Note: All formulas are written in (\LaTeX) format.

inputFormat

The first line contains an integer \(N\) \( (1 \leq N \leq 1000)\), representing the number of non‐capital cities.

The following \(N\) lines each contain two integers \(x_i\) and \(y_i\) denoting the coordinates of city \(i\) for \(i = 1,2,\dots,N\).

The capital is fixed at \((0,0)\) and is considered as city 0.

outputFormat

Output a single line containing either Yes or No (without quotes), indicating whether there exists a partition of the cities between the two teams such that the sum of their \(\gamma\) values is equal.

sample

3
1 0
2 0
3 0
Yes