【经典问题】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 ...
随机推荐
- CCPC-Wannafly & Comet OJ 夏季欢乐赛(2019)G
题面 一道暴水的dp....别问我为什么直接打开了G题,我只是对题目名称感兴趣而已.... #include<bits/stdc++.h> #define ll long long usi ...
- 怎样求控制器的增益系数k?
步骤: 1. \dot x =A*x + B*u is a state space model, with A and B are known. Now we want to locate the ...
- Charles中文破解版下载安装及使用教程
下载地址:https://pan.baidu.com/s/1praYZAw23psZLi59hKJjqw 一. 简介及安装 Charles 是在 PC 端常用的网络封包截取工具,但它不仅仅能在pc端使 ...
- sqoop数据导出
1.将oracle的jdbc的jar包copy到sqoop的lib目录下 2. sqoop export --connect jdbc:oracle:thin:@XXXXX:1521:TMDM --u ...
- 读redux源码总结
redux介绍 redux给我们暴露了这几个方法 { createStore, combineReducers, bindActionCreators, applyMiddleware, compos ...
- 如何使用getattr运行单个函数
import sys def foo(): print("哈哈想不到吧") if __name__ == '__main__': getattr(sys.modules[__nam ...
- Linux TCP自连接问题
[参考文章]:net.ipv4.ip_local_port_range 的值究竟影响了啥 [参考文章]:Linux内核参数优化 最近卸载MySQL服务偶尔会遇到MySQL端口自连接问题.导致MySQL ...
- (十七)C语言之变量
- SV服务器
什么是服务端? 就是安装了服务端软件的电脑 下载 VisualSVN是一款图形化svn服务器. 官 网: http://www.visualsvn.com/server/ 下载地址: http://w ...
- java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:list
package DisplayAuthors; import java.sql.*; public class DisplayAuthors { private static final Str ...