A872 | Multiple Choice Test--Platinum
来源USACO
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
The cows are taking a multiple choice test. But instead of a standard test
where your selected choices are scored for each question individually and then
summed, in this test your selected choices are summed before being scored.
Specifically, you are given $N$ ($2\le N\le 10^5$) groups of integer vectors
on the 2D plane, where each vector is denoted by an ordered pair $(x,y)$.
Choose one vector from each group such that the sum of the vectors is as far
away from the origin as possible.
It is guaranteed that the total number of vectors is at most $2\cdot 10^5$.
Each group has size at least $2$, and within a group, all vectors are
distinct. It is also guaranteed that every $x$ and $y$ coordinate has absolute
value at most $\frac{10^9}{N}$.
where your selected choices are scored for each question individually and then
summed, in this test your selected choices are summed before being scored.
Specifically, you are given $N$ ($2\le N\le 10^5$) groups of integer vectors
on the 2D plane, where each vector is denoted by an ordered pair $(x,y)$.
Choose one vector from each group such that the sum of the vectors is as far
away from the origin as possible.
It is guaranteed that the total number of vectors is at most $2\cdot 10^5$.
Each group has size at least $2$, and within a group, all vectors are
distinct. It is also guaranteed that every $x$ and $y$ coordinate has absolute
value at most $\frac{10^9}{N}$.
输入格式
The first line contains $N$, the number of groups.
Each group starts with $G$, the number of vectors in the group, followed by
$G$ lines containing the vectors in that group. Consecutive groups are
separated by newlines.
Each group starts with $G$, the number of vectors in the group, followed by
$G$ lines containing the vectors in that group. Consecutive groups are
separated by newlines.
输出格式
The maximum possible squared Euclidean distance.
输入输出样例
输入 #1
3 2 -2 0 1 0 2 0 -2 0 1 3 -5 -5 5 1 10 10
输出 #1
242
It is optimal to select $(1,0)$ from the first group, $(0,1)$ from the second
group, and $(10,10)$ from the third group. The sum of these vectors is
$(11,11)$, which is squared distance $11^2+11^2=242$ from the origin.
group, and $(10,10)$ from the third group. The sum of these vectors is
$(11,11)$, which is squared distance $11^2+11^2=242$ from the origin.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted