AtCoder Beginner Contest 139 Task F Engines

题目大意

给定 $n$ 个二维向量,从中选出若干个,使得它们的和的模最大。

分析

这是一个经典问题,还有一种提法是:

给定 $n$ 个二维向量 $v_1, v_2, \dots, v_n$,求一组系数 $a_1, a_2, \dots, a_n$($0 \le a_i \le 1$)使得 $\sum_{i = 1}^{n} a_i v_i$ 的模最大。
容易证明:对于最优解,$a_i$ 要么是 1 要么是 0;于是归约到选择一个最优子集的问题。

可以证明,最优解满足下列两个性质:

  • The set of vectors in an optimal solution using a minimal number of vectors must all lie in an open half-plane. 包含向量数目最少的最优解中,所有向量都在一个的半平面中

如果加上「所选的向量都在一个的半平面中」这个限制,我们立即可以推论出,若先把所有向量按极角排序,则所选的那些向量必定是其中连续的一段。换言之,

  • 对于包含向量数目最少的最优解,其中的向量按极角排序后是连续的一段。The vectors in the optimal solution using a minimal number of vectors are contiguous when ordered according to angle circularly.

References

https://math.stackexchange.com/q/730611/538611

【经典问题】maximum subset sum of vectors的更多相关文章

  1. Light OJ 1272 Maximum Subset Sum 高斯消元 最大XOR值

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/u011686226/article/details/32337735 题目来源:problem=12 ...

  2. [leetcode]124. Binary Tree Maximum Path Sum二叉树最大路径和

    Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any ...

  3. PAT Advanced 1007 Maximum Subsequence Sum

    题目 1007 Maximum Subsequence Sum (25分) Given a sequence of K integers { N1, N2, ..., N**K }. A contin ...

  4. [LeetCode] Binary Tree Maximum Path Sum 求二叉树的最大路径和

    Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. ...

  5. [leetcode]Binary Tree Maximum Path Sum

    Binary Tree Maximum Path Sum Given a binary tree, find the maximum path sum. The path may start and ...

  6. LeetCode(124) Binary Tree Maximum Path Sum

    题目 Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequen ...

  7. LeetCode124:Binary Tree Maximum Path Sum

    题目: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tr ...

  8. leetcode 124. Binary Tree Maximum Path Sum

    Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence ...

  9. [lintcode] Binary Tree Maximum Path Sum II

    Given a binary tree, find the maximum path sum from root. The path may end at any node in the tree a ...

随机推荐

  1. Rabbitmq的高级特性

    消息如何保证100%投递成功? 什么是生产端的可靠性投递? 1.保障消息的成功发出 2.保障MQ节点的成功接收 3.发送端收到MQ节点(Broker)确认应答 4.完善的消息补偿机制 BAT互联网大厂 ...

  2. css基础(浮动 清除f浮动)

    文档流(标准流) 1.元素自上而下,自左而右  2.块元素,独占一行,行内元素在一行上显示,碰到父级元素的边框换行   浮动left 浮动的框可以向左或是向右移动,直到它的边缘碰到包含框或是另个浮动框 ...

  3. HNOI2012矿场搭建

    做完Mining Your Own Business后觉得这个题没什么意思了,数据范围小的连边数不清空都能A. 题解直接看这篇吧.做题的经历也挺……对吧. #include<iostream&g ...

  4. 10.矩形覆盖 Java

    题目描述 我们可以用2**1的小矩形横着或者竖着去覆盖更大的矩形.请问用n个21的小矩形无重叠地覆盖一个2n的大矩形,总共有多少种方法? 思路 其实,倒数第一列要么就是1个2**1的矩形竖着放,要么就 ...

  5. Maximum upload size exceede上传文件大小超出解决

    在这里记录三种方法, 努力提高自己的姿势水平 application.yml配置 spring: servlet: multipart: enabled: true max-file-size: 10 ...

  6. php phpexcel 创建excel

    public function createExcel($result=[],$fileName=''){ \think\Loader::import('extend.excel.PHPExcel', ...

  7. Python 之 subprocess模块

    一.subprocess以及常用的封装函数运行python的时候,我们都是在创建并运行一个进程.像Linux进程那样,一个进程可以fork一个子进程,并让这个子进程exec另外一个程序.在Python ...

  8. String,int,Integer之间的转换

    public class Test{ public static void main(String[] args) { //int转换成Integer Integer in = new Integer ...

  9. WorkStation 虚拟机迁移到 ESXi

    将Workstation的vmdk文件导入到Esxi. 提示如题错误提示. 无法打开磁盘 scsi0:0: 磁盘类型 7 不受支持或无效.请确保磁盘已导入. 在VMware Workstation,V ...

  10. 设计模式--观察者模式--python

    观察者模式: 对象间的一种一对多的依赖关系,当一个对象的状态发生改变时, 所有依赖于它的对象都得到通知并被自动更新. 主要解决: 当一个抽象模型有两个方面, 其中一个方面依赖于另一方面.将这二者封装在 ...