摘要: 点分治 点分治可以用来处理有关树上路径的问题 首先选取当前子树的重心作为分治点,因为重心可保证最大的子树不超过(u/2),这样每次递归的处理下去,复杂度是(nlogn)的 求重心代码: void getroot(int u,int par){ sz[u]=1,son[u]=0; for(int i= 阅读全文
posted @ 2019-03-06 14:10 Tartarus_li 阅读(257) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/show/P3781 阅读全文
posted @ 2019-03-06 10:37 Tartarus_li 阅读(175) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/solution/P4221 阅读全文
posted @ 2019-03-06 10:11 Tartarus_li 阅读(236) 评论(0) 推荐(0) 编辑