随笔分类 - 分治
摘要:Jam like to solve the problem which on the 3D-axis,given N(1=xj,yi>=yj,zi>=zj,the bigger one level add 1.Ask for the each level of the...
阅读全文
摘要:Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between ...
阅读全文
摘要:点分治的时间复杂度为O(NlogN)。由于每次都是找重心,所以处理完一个大小为N的树后,每个子树的大小最大都为N/2,所以最多分治NlogN层,每层都是N所以是O(NlogN)。【具体流程】1,选取一个点,将无根树变成有根树 为了使每次的处理最优,我们通常要选取树的...
阅读全文