【经典问题】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
转载于:https://www.cnblogs.com/Patt/p/11535310.html
【经典问题】maximum subset sum of vectors相关推荐
- 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. ...
- 124. Binary Tree Maximum Path Sum
题目: Given a binary tree, find the maximum path sum. For this problem, a path is defined as any seque ...
- Binary Tree Maximum Path Sum
Binary Tree Maximum Path Sum 题目链接:https://leetcode.com/problems... dfs对每个node,查一下包含这个node的最大路径值. /** ...
- 124 Binary Tree Maximum Path Sum
题目: 124 Binary Tree Maximum Path Sum 这道题就是分别算出左子树和右子树的可能最大和,然后对Path的值进行更新即可 class Solution:def __ini ...
- PAT甲级1007 Maximum Subsequence Sum :[C++题解]DP,最大子序列和、求最优的区间方案
文章目录 题目分析 题目链接 题目分析 来源:acwing 分析: dp题. 这道题糅合了两个知识点: dp求最值(区间之和) 动态求区间方案:区间之和相等的条件下:要求区间左端点最靠前,如果左端点相 ...
- 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.Fo ...
- 1007 Maximum Subsequence Sum
1007 Maximum Subsequence Sum (25 分) Given a sequence of K integers { N1, N2, ..., NK }. A c ...
- 【Binary Tree Maximum Path Sum】cpp
题目: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tr ...
- [Leetcode] Binary Tree Maximum Path Sum
这是LeetCode上的一道题目,需要求二叉树中两点路径的最大和.原题是 https://oj.leetcode.com/problems/binary-tree-maximum-path-sum/ ...
最新文章
- LeetCode Power of Two
- MongoDB 小试牛刀
- 最近做项目的一些关于重构方面的总结
- Java笔记-spring boot支持jsp文件做前端页面
- 郁闷,两个伤脑筋的power script 问题
- 【数据结构】二叉树的python实现
- android之camera
- 【JZOJ】立体井字棋
- 计算机专业毕业论文谢辞,计算机毕业论文谢辞模板(精选模板三篇)
- 数据科学和人工智能技术笔记 十八、Keras
- 深圳中学因招聘上热搜:名校博士挤破头想进,教学成绩也确实不服不行
- html动态背景分享,酷炫一款动态背景(HTML +js canvas)
- 将Jetson XavierNX的Ubuntu系统迁移至到nvme固态硬盘上
- mysql备份导出数据库结构_MySql数据库导出完整版(导出数据库,导出表,导出数据库结构)详解...
- 《高效能人士的七个习惯》读书摘记
- 二分(二分查找,二分搜索)
- GitHub各种加速方式
- 重磅:DDN携手潭州学院,全面开启区块链3.0——人才输出、应用落地时代!
- 鸿蒙os页面格式简介
- 金融数学笔记Chapter01
热门文章
- 76. 最小覆盖子串
- 1371. Find the Longest Substring Containing Vowels in Even Counts
- ZYAR20A 亚克力2驱 蓝牙 298寻迹避障机器人 —— 小车黑线循迹红外避障综合实验
- 《信息学奥赛一本通》 高精度乘法。输入两个正整数,求它们的积。
- Java面向对象(四)final关键字
- 【IT资讯】TIOBE 7月编程语言排行榜显示,这些编程语言更吃香
- centos7怎么重置mysql密码_centOS7.4 重置mysql 密码
- html使用js的变量_JS变异小技巧:使用JavaScript全局变量绕过XSS过滤器
- givemesomecredit数据_你是如何走上数据分析之路的?
- 自认为有必要学习的Sql 总结,积累 mybatis