码迷,mamicode.com
首页 >  
搜索关键字:树分治    ( 232个结果
数据结构(平衡树,树分治,暴力重构):WC 2014 紫荆花之恋
【题目描述】 强强和萌萌是一对好朋友。有一天他们在外面闲逛,突然看到前方有一棵紫荆树。这已经是紫荆花飞舞的季节了,无数的花瓣以肉眼可见的速度从紫荆树上长了出来。 仔细看看的话,这棵大树实际上是一个带权树。每个时刻他会长出一个新的叶子节点。每个节点上有一个可爱的小精灵,新长出的节点上也会同时出现一个新 ...
分类:其他好文   时间:2016-09-10 22:17:51    阅读次数:229
树分治&树链剖分相关题目讨论
预备知识 树分治,树链剖分 poj1741 ?一棵有n个节点的树,节点之间的边有长度。方方方想知道,有多少个点对距离不超过m 题解 点分治模板题。详见我早上写的http://www.cnblogs.com/chouti/p/5836926.html OrzFang Ⅸ ?有一棵n个点,边长为1的树,... ...
分类:其他好文   时间:2016-09-03 22:28:03    阅读次数:121
Poj1741(Tree)
题意:找树上有多少对距离小于K的对数解析:树分治模板题,见注释 代码 #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<vector> using namespace std; typed ...
分类:其他好文   时间:2016-08-21 21:06:22    阅读次数:133
POJ1751 Tree 树分治
分析:每次找重心可以发现最多n层,每层复杂度是O(nlogn) 总体时间复杂度是O(nlog^2n) #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #in ...
分类:其他好文   时间:2016-08-16 00:29:11    阅读次数:190
HDU 4812 D Tree 树分治+逆元处理
D Tree Problem Description There is a skyscraping tree standing on the playground of Nanjing University of Science and Technology. On each branch of t ...
分类:其他好文   时间:2016-08-15 14:10:12    阅读次数:211
BZOJ1095 [ZJOI2007]Hide 捉迷藏
动态树分治,用三个set分别维护每个重心到每一个子树的距离种类、每个重心所有子树的最大值和次大值、全局答案的最大值。复杂度O(nlogn^2) 代码 ...
分类:其他好文   时间:2016-08-01 01:40:23    阅读次数:255
POJ 1987 Distance Statistics 树分治
Distance Statistics Description Frustrated at the number of distance queries required to find a reasonable route for his cow marathon, FJ decides to a ...
分类:其他好文   时间:2016-07-21 21:40:37    阅读次数:169
POJ 1741 Tree 树分治
Tree Description 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 ...
分类:其他好文   时间:2016-07-21 19:31:39    阅读次数:395
Codeforces 161D Distance in Tree
题目大意:给出一棵n个节点的树,统计树中长度为k的路径的条数(1<=n<=50000 , 1<=k<=500) 思路:树分治! ...
分类:其他好文   时间:2016-07-14 01:37:09    阅读次数:180
FJ省队集训最终测试 T2
思路:发现如果一个人一共选了x个点,那么选中某一个点对的概率都是一样的,一个人选x个点的总方案是C(n,x),一个人选中某个点对的总方案是C(n-2,x-2),这样,那么选中某个点对的概率就是 x*(x-1)/(n*(n-1)),这样,我们就用树分治求出有多少对符合条件的对数,然后乘上每个人的概率即 ...
分类:其他好文   时间:2016-07-09 19:34:00    阅读次数:172
232条   上一页 1 ... 13 14 15 16 17 ... 24 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!