【经典问题】maximum subset sum of vectors
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的更多相关文章
- Light OJ 1272 Maximum Subset Sum 高斯消元 最大XOR值
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/u011686226/article/details/32337735 题目来源:problem=12 ...
- [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 ...
- PAT Advanced 1007 Maximum Subsequence Sum
题目 1007 Maximum Subsequence Sum (25分) Given a sequence of K integers { N1, N2, ..., N**K }. A contin ...
- [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. ...
- [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 ...
- 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 ...
- 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 ...
- 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 ...
- [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 ...
随机推荐
- poj 2431 Expedition 贪心+优先队列 很好很好的一道题!!!
Expedition Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10025 Accepted: 2918 Descr ...
- 微信小程序“反编译”
https://www.jianshu.com/p/ad8f417219e9 https://segmentfault.com/a/1190000018592740?utm_source=tag-ne ...
- 0.spring cloud目录
1. 微服务架构概述 1.0. 单体架构是什么 1.1. 单体应用架构存在的问题 1.2. 如何解决单体应用架构存在的问题 1.3. 什么是微服务 1.4. 微服务架构的优点与挑战 1.4.1. 微服 ...
- TCP滑动窗口Sliding Window
滑动窗口的发送窗口示意图如下,其中由对端通告的窗口窗口大小为6,窗口中和窗口外的数据分别表示为:1-3发送并已经被确认的数据段,4-6发送但尚未被确认的数据段,7-9能够发送尚未发送的数据段,10-… ...
- nginx中location匹配规则介绍
一,匹配规则 1,= 表示精确匹配 例子:http://localhost/ 将匹配到 location = / {...} http://localhost/aaa 可以匹配到 location ...
- LC 889. Construct Binary Tree from Preorder and Postorder Traversal
Return any binary tree that matches the given preorder and postorder traversals. Values in the trave ...
- Bootstrap-CSS:目录
ylbtech-Bootstrap-CSS:目录 1.返回顶部 1. 2. 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 1. 2. 6.返回顶部 7.返回顶部 ...
- struts数据回显
数据回显,必须要用struts标签! Action中: // 进入修改页面 public String viewUpdate() { // 模拟一个对象(先获取一个id,再根据id调用service查 ...
- 003-Spring4 扩展分析-spring类初始化@PostConstruct > InitializingBean > init-method、ApplicationContext、BeanPostProcessor、BeanFactoryPostProcessor、BeanDefinitionRegistryPostProcessor
一.spring类初始化@PostConstruct > InitializingBean > init-method InitializingBean接口为bean提供了初始化方法的方式 ...
- 物料主数据批导bapi
创建物料主数据,根据模板不同批导原材料,半成品,成品.可根据实际需求对字段进行增删. report zmmr_bapi_mm01 no standard page HEADING. type-POOL ...