
分治
文章平均质量分 82
风之旅@
努力到一定的程度,幸运就会与你不期而遇
展开
-
53. 最大子数组和
动态规划原创 2023-07-17 21:08:27 · 143 阅读 · 0 评论 -
23. 合并K个升序链表
力扣原创 2023-02-25 11:24:51 · 880 阅读 · 0 评论 -
树的分治 POJ - 1741
树的分治树的分治分为点分治和边分治,在这里先介绍点分治,边的分治以后补充点分治:点分治最重要的一点就是找树的重心,在将点分治之前先介绍什么是树的重心树的重心:树的重心也叫树的质心。对于一棵树n个节点的无根树,找到一个点,使得把树变成以该点为根的有根树时,最大子树的结点数最小。只看定义的话对于初学者...原创 2019-01-22 18:29:26 · 322 阅读 · 0 评论 -
HDU - 5721 Palace
The last trial Venus imposes on Psyche is a quest to the underworld. She is to take a box and obtain in it a dose of the beauty of Prosperina, queen of the underworld. There are nn palaces in the un...原创 2019-01-02 22:32:40 · 234 阅读 · 0 评论 -
POJ - 3714 Raid (平面分治最小点对)
After successive failures in the battles against the Union, the Empire retreated to its last stronghold. Depending on its powerful defense system, the Empire repelled the six waves of Union's attack....原创 2018-12-31 19:03:27 · 527 阅读 · 0 评论 -
POJ - 2299 Ultra-QuickSort
In this problem, you have to analyze a particular sorting algorithm.The algorithm processes a sequence of n distinct integers byswapping two adjacent sequence elements until the sequenceis sort...原创 2019-01-04 21:52:13 · 184 阅读 · 0 评论 -
HDU - 1007 Quoit Design
Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded. In the field of Cyberground, the position of each toy i...原创 2019-01-03 21:59:39 · 491 阅读 · 0 评论 -
51Nod - 1019 逆序数 (归并排序)
在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。如2 4 3 1中,2 1,4 3,4 1,3 1是逆序,逆序数是4。给出一个整数序列,求该序列的逆序数。 Input第1行:N,N为序列的长度(n <= 50000) 第2 - N + 1行:序列中的元素(0 <= Ai...原创 2018-12-23 12:42:06 · 155 阅读 · 0 评论 -
CodeForces - 559B Equivalent Strings
Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases:They are equal. If we spli...原创 2018-12-24 15:44:15 · 300 阅读 · 0 评论 -
寻找距离最小的平面点对——分治方法
在应用中,常用诸如点、圆等简单的几何对象代表现实世界中的实体。在涉及这些几何对象的问题中,常需要了解其邻域中其他几何对象的信息。例如,在空中交通控制问题中,若将飞机作为空间中移动的一个点来看待,则具有最大碰撞危险的2架飞机,就是这个空间中最接近的一对点。这类问题是计算几何学中研究的基本问题之一。下面我们着重考虑平面上的最接近点对问题。最接近点对问题的提法是:给定平面上n个点,找其中的一...原创 2018-12-26 22:37:37 · 5792 阅读 · 0 评论