#USACOC2221C. Multiple Choice Test
Multiple Choice Test
Description
The cows are taking a multiple choice test. But instead of a standard test where yourselected choices are scored for each question individually and then summed, inthis test your selected choices are summed before being scored.
Specifically, you are given groups of integer vectors onthe 2D plane, where each vector is denoted by an ordered pair . Chooseone vector from each group such that the sum of the vectors is as far away fromthe origin as possible.
It is guaranteed that the total number of vectors is at most . Each group has size at least , and within a group, all vectors are distinct. It is also guaranteed that every and coordinate has absolute value atmost .
Input Format
The first line contains , the number of groups.
Each group starts with , the number of vectors in the group, followed by lines containing the vectors in that group. Consecutive groups are separated bynewlines.
Output Format
The maximum possible squared Euclidean distance.
3
2
-2 0
1 0
2
0 -2
0 1
3
-5 -5
5 1
10 10
3
2
-2 0
1 0
2
0 -2
0 1
3
-5 -5
5 1
10 10
Scoring
- In test cases 1-5, the total number of vectors is at most .
- In test cases 6-9, every group has size exactly two.
- Test cases 10-17 satisfy no additional constraints.
Problem Credit
Problem credits: Benjamin Qi