
树哈希
a1s4z5
这个作者很懒,什么都没留下…
展开
-
CodeForces Round 718D - Andrew and Chemistry
给出一个每个节点的度小于4的树,问有多少种增加叶子的方式(保持每个节点的度小于4)。增加之后的树同构的算一种第二个树哈希#include<bits/stdc++.h> using namespace std;#define LL long long const int maxn = 112345;vector<int> edge[maxn]; int dep[maxn],fa[maxn];void原创 2016-11-16 11:33:43 · 564 阅读 · 0 评论 -
Hdu 5732 Subway
给你两个同构的树,找出他们节点间的对应方式树哈希本质上就是一个树dp。考虑以树的唯一的一个节点(比如重心,直径中点)作为树根,然后用一个和子树顺序无关的方式去哈希就好了。具体见代码#include<bits/stdc++.h> using namespace std;const int maxn = 112345; #define LL long long #define Deag const i原创 2016-11-14 22:12:19 · 353 阅读 · 0 评论