diff --git a/graph/hld.cc b/graph/hld.cc index 28e4bed..d0c6db6 100644 --- a/graph/hld.cc +++ b/graph/hld.cc @@ -2,11 +2,11 @@ namespace HLD { struct node_info { int father, depth, hson, size, head, dfn = -1; }; - // returns: (dfs sequence, node info) // node numbering starts from `1` // if `dfn(v) == -1`, then node `v` is never accessed. - pair, vector> work(int n, const vector>& ch, int root = 0) { + pair, vector> work(const vector>& ch, int root = 0) { + int n = ch.size() - 1; vector seq; vector res(n + 1); auto dfs1 = [&] (auto dfs1, int v, int pa) -> void {