lca真心不太会,这里只介绍60分做法,100的太~~难辣~~简单了就不介绍了 n include include include using namespace std; const int maxn=300000; const int maxn_25=1000; struct edge { in ...
分类:
其他好文 时间:
2018-09-20 17:30:19
阅读次数:
185
BaoBao has just found a rooted tree with n vertices and (n-1) weighted edges in his backyard. Among the vertices, of them are red, while the others ar ...
分类:
其他好文 时间:
2018-09-19 23:39:15
阅读次数:
430
倍增新高度——树上倍增(其实差不多啦) 首先倍增就不说了 那么树上倍增和倍增有什么区别呢? 其实没什么区别,对于树上的结点u, 我们同样用st[u][l]数组记录其结点u向上2^l步数中权值最小(最大)的值 但是树上的边不是连续的啊,这我们怎么去维护呢? 这时,我们需要引入一个辅助数组f数组, 对于 ...
分类:
其他好文 时间:
2018-09-19 17:14:56
阅读次数:
156
给一颗树,其中树中有一些红色的点,每个点到距离它最近的祖先红点的距离称为它的距离。 每次给一个点子集,可以选择把树中任意一个点变为红色,问怎样让子集里的点的距离最大值最小。 当只有两个点时,肯定是先找到他们的 lca 然后先判断将 lca 染红是否可以让最大的距离变小,如果有一个点的祖先红点在 lc ...
分类:
其他好文 时间:
2018-09-17 15:21:14
阅读次数:
133
模版题 https://www.luogu.org/problemnew/show/P3379 1 #include<algorithm> 2 #include<iostream> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cstdio> ...
分类:
其他好文 时间:
2018-09-17 00:04:53
阅读次数:
166
WIKI NOS:https://en.wikipedia.org/wiki/Network_operating_system Examples: JUNOS, used in routers and switches from Juniper Networks Cisco Internetwork ...
分类:
其他好文 时间:
2018-09-16 01:00:43
阅读次数:
460
The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. A binary search tree (BST) i ...
分类:
其他好文 时间:
2018-09-15 21:59:23
阅读次数:
192
!!!原来LCA的题可以出的这么难,完了这还属于水题?! 先来解释一下题意,有N个城市,在这N城市之间有M条边(不一定每个城市都有边)。我们的任务是找出给定两个点之间路径上的最小边权,使得这个最小边权尽量大。一开始我很纳闷,这和LCA有什么关系呢,怎么和最大流有点像。冥思苦想(看了别人的想法)之后, ...
分类:
其他好文 时间:
2018-09-15 13:13:25
阅读次数:
211
What I do is derived from my pursuit of dreams. 1. Simultaneous Localization and Mapping(http://blog.exbot.net/archives/2515) It must be achieved thre ...
分类:
其他好文 时间:
2018-09-14 23:15:35
阅读次数:
254
对于三个点求最小路径长度和,答案肯定在某两个点的lca上,因为如果把集合点定在公共lca上,一定有两个点汇合后再一起上到lca,这样显然不如让剩下的那个点下来 这个lca可能是深度最深的……但是我懒得证了,反正只有三个lca,每个都求一遍然后取个max就好啦 cpp include include ...
分类:
其他好文 时间:
2018-09-14 14:33:02
阅读次数:
179