[BestCoder Round #88]Tree Cutting
来源:互联网 发布:python数组长度 编辑:程序博客网 时间:2024/04/29 07:32
题目大意
给定一棵
定义一棵树的权值为所有点权异或和。
现在对于
联通子树:树的一个联通子图(显然它也是一棵树)
一个测试点
保证
题目分析
Solution 1
考虑如果我们确定某个点是一定要选取的,那么我们将其作为根。
那么树中一个点如果选了,它的父亲一定要被选取。
这个树形依赖关系是不是特别熟悉?对了,就是和[JSOI2016]最佳团队类似的模型。
按照
但是一次
可以发现一个点如果考虑过,那么就可以将问题分配到它的几个子树来分治了。这个就是经典的点分治,每次选取重心
时间复杂度
很不错的一个思想。
Solution 2
把
设
这是标准的异或卷积形式,可以使用
我们会计算
这个方法比较显然,但是像我这样的不会
0 0
- [BestCoder Round #88]Tree Cutting
- BestCoder Round #88
- BestCoder Round #88
- [BestCoder Round #89]Fxx and tree
- Tree Cutting
- BestCoder Round #16 Revenge of Segment Tree (树状数组)
- HDU-5086-Revenge of Segment Tree (BestCoder Round #16)
- hdu 5086 Revenge of Segment Tree(BestCoder Round #16)
- hdu 5086 Revenge of Segment Tree(BestCoder Round #16)
- [BestCoder Round #25 1003]Harry and Christmas tree
- hdu 5274 Dylans loves tree && BestCoder Round #45
- BestCoder Round #53 (div.2) 1002 Rikka with Tree
- BestCoder Round #53 (div.2) HDOJ5423 Rikka with Tree(bfs)
- Rikka with Tree-----(BestCoder Round #53 (div.2))
- BestCoder Round #65 D. ZYB's Tree(树形dp)
- BestCoder Round #68 (div.2)-tree(并查集)
- HDU 5606 tree BestCoder Round #68 (div.2) [思维]【数学】
- BestCoder Round#88 1001 Find Q 水题
- 小话设计模式(十四)命令模式
- HDU2212-DFS
- [LeetCode]--38. Count and Say
- 409. Longest Palindrome
- 240. Search a 2D Matrix II
- [BestCoder Round #88]Tree Cutting
- &a + 1和 &(a+1)
- 解决 Unable to load native-hadoop library for your platform
- 缓冲区溢出练习2
- 新的开始
- CodeForces Round#340 E:XOR and Favorite Number(莫队算法)
- 重新安装Linux后Samba服务器无法访问的解决办法
- 设计模式之装饰者(Decorator)模式
- 为什么Struts、Spring、Hibernate框架可以被整合的问题