P10671 BZOJ1278 Vector vector
Description
The weight of a two-dimensional vector $(x, y)$ is defined as $x^2 + y^2$. Given a set consisting of $n$ two-dimensional vectors, find a subset such that the weight of the sum of the vectors in this subset is as large as possible.
Input Format
The first line contains a positive integer $n$, indicating that there are $n$ vectors.
The next $n$ lines each contain $2$ real numbers, representing the $n$ vectors $(x_i, y_i)$.
Output Format
Output $1$ real number, i.e., the maximum possible weight of the vector sum, accurate to $3$ digits after the decimal point.
Explanation/Hint
Constraints: it is guaranteed that $1 \leq n \leq 100000$.
Translated by ChatGPT 5