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. Confluence 6.15 修改历史(Change-History)宏

    修改历史(Change-History)宏显示了页面一个的更新历史:版本号,作者,日期和备注.这些内容将会在同一栏中进行显示. 屏幕截图:Confluence 中的修改历史(Change-Histor ...

  2. 动态DP教程

    目录 前言 开始 更进一步 前言 最后一届NOIPTG的day2T3对于动态DP的普及起到了巨大的作用.然而我到现在还不会 开始 SP1716 GSS3 - Can you answer these ...

  3. Nginx事件管理之ngx_event_core_module模块

    1. 概述 ngx_event_core_module 模块是一个事件类型的模块,它在所有事件模块中的顺序是第一位.它主要完成以下两点任务: 创建连接池(包括读/写事件): 决定究竟使用哪些事件驱动机 ...

  4. git合并同事代码

    git 操作: 如果龙哥提交了代码,我想拉去过来,我需要的操作: 1.git fetch 2. git add . 3.git commit -m '' 提交本地的文件 4.git merge ori ...

  5. phpstorm 比较修改过的代码 version control

  6. koa 基础(二十四)封装 DB 库 --- 新增数据、更新数据、删除数据

    1.根目录/module/db.js /** * DB库 */ var MongoClient = require('mongodb').MongoClient; var Config = requi ...

  7. [论文理解] An Analysis of Scale Invariance in Object Detection – SNIP

    An Analysis of Scale Invariance in Object Detection – SNIP 简介 小目标问题一直是目标检测领域一个比较难解决的问题,因为小目标提供的信息比较少 ...

  8. selenium expected_conditions 源码学习记录

    #expected_conditions模块收集了一系列的场景判断方法 #源码地址 # https://seleniumhq.github.io/selenium/docs/api/py/_modul ...

  9. 连续子数组的最大和 java实现

    package findMax; /** * 连续子数组的最大和 * @author root * */ public class FindMax { static int[] data = {1,- ...

  10. vue.js-动态绑定class 利用index实现导航

    <template> <div class="stock"> <div class="buin_leftcont nav_ctrl" ...