Let P be a set of an even number of distinct points on the plane.
A vector matching V of set P is a set of vectors where each
vector starts at one point in P and ends at another, and each
point in P is either the head or tail of exactly one vector in
the matching. Thus, there are half as many vectors in V as there
are points in P.
You are given int[]s x and y, where (x[i], y[i]) are the coordinates
of the i-th point of P. Find a vector matching V for set P such
that the length of the vector sum of the vectors in V is minimal,
and return this length. |