随笔分类 - 分治
摘要:Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected roads, and for any two cities
阅读全文
摘要:Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an i
阅读全文
摘要:推荐博客 : http://blog.csdn.net/ZHangFFYY/article/details/77871897 我们对一个图的存储基本有两种,邻近矩阵和邻接表 ,在补充一个链式前向星 用此方法存图 , 首先先定义一个结构体数组 struct node { int to, w; // t
阅读全文
摘要:关于树上的分治,分为对 树上点的分治 和 边的分治 首先我们先来了解一下树的重心的定义 : 将树的重心删去以后,会被分出很多的子树,结点最多的树的个数最少,这个点称为树的重心 推荐博客 : https://www.cnblogs.com/Paul-Guderian/p/6782671.html 推荐
阅读全文
摘要:Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Ol
阅读全文
摘要:After successive failures in the battles against the Union, the Empire retreated to its last stronghold. Depending on its powerful defense system, the
阅读全文
摘要:Bizon the Champion isn't just attentive, he also is very hardworking. Bizon the Champion decided to paint his old fence his favorite color, orange. Th
阅读全文
摘要:推荐博客 : https://www.cnblogs.com/zyxStar/p/4591897.html 问题描述 : 已知在平面上有散落的好多点,求相距最近的两个点的距离是多少 ? 一 、 穷举法 最暴力的解法,枚举出所有可能的点对,这样复杂度就是 n^2 二 、分治法 (复杂度 n*logn)
阅读全文