Potentialized Union Find Tree (ポテンシャルつきUnionFind木)
(structure/potentialized-union-find-tree.hpp)
コンストラクタ
PotentializedUnionFindTree<T, op, invop, e>()
T: 群(の載ってる集合), op: 二項演算, invop: 二項演算の逆元, e: 二項演算の単位元を返す関数。
merge
int merge(int a, int b, T t)
aのポテンシャル - bのポテンシャルがt
になるように併合する。
計算量
diff
aのポテンシャル - bのポテンシャルを計算する。
計算量
Verified with
Code
Back to top page