Link Cut Tree
(library/data-structure/lazy-lct.hpp)
使用方法
int n;
lazy_LCT<S, e, op, reversal, F, id, mapping, composition> lct(n);
int u, v;
lct.link(u, v);
lct.cut(u, v);
bool connected = lct.is_connected(u, v);
lct.set(u, S{});
S val = lct.get(u);
lct.apply(u, v, F{});
S res = lct.prod(u, v);
References
CF - Link Cut Tree implementation
CF - Maintain subtree information using link/cut trees)
https://judge.yosupo.jp/submission/7137
https://hitonanode.github.io/cplib-cpp/data_structure/link_cut_tree.hpp
Verified with
Code
Back to top page