Update graph/hld.cc
Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
parent
72fa16acd0
commit
58e96d0164
|
@ -68,9 +68,10 @@ struct HLD {
|
||||||
swap(u, v);
|
swap(u, v);
|
||||||
}
|
}
|
||||||
tr.range_apply(info[info[u].head].dfn, info[u].dfn, t);
|
tr.range_apply(info[info[u].head].dfn, info[u].dfn, t);
|
||||||
|
u = info[info[u].head].father;
|
||||||
}
|
}
|
||||||
if (info[u].depth < info[v].depth) swap(u, v);
|
if (info[u].depth < info[v].depth) swap(u, v);
|
||||||
tr.range_apply(info[v].dfn, info[u].dfn);
|
tr.range_apply(info[v].dfn, info[u].dfn, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info path_query(int u, int v) {
|
Info path_query(int u, int v) {
|
||||||
|
@ -80,6 +81,7 @@ struct HLD {
|
||||||
swap(u, v);
|
swap(u, v);
|
||||||
}
|
}
|
||||||
res = res + tr.range_query(info[info[u].head].dfn, info[u].dfn);
|
res = res + tr.range_query(info[info[u].head].dfn, info[u].dfn);
|
||||||
|
u = info[info[u].head].father;
|
||||||
}
|
}
|
||||||
if (info[u].depth < info[v].depth) swap(u, v);
|
if (info[u].depth < info[v].depth) swap(u, v);
|
||||||
res = res + tr.range_query(info[v].dfn, info[u].dfn);
|
res = res + tr.range_query(info[v].dfn, info[u].dfn);
|
||||||
|
|
Loading…
Reference in New Issue