Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. inline int recalc(int x, int sbz) {
  2. for (; p[x] != -1 && !usd[p[x]]; x = p[x])
  3. sz[x] -= sbz;
  4. sz[x] -= sbz;
  5. return x;
  6. }
  7.  
  8. void decompose(int x, int cpr) {
  9. int ct = find_centroid(x, sz[x]); usd[ct] = 1;
  10. for (int i = 0; i < g[ct].size(); i++) {
  11. int to = g[ct][i];
  12. if (usd[to]) continue;
  13. if (to == p[ct]) {
  14. to = getp(to, sz[ct]);
  15. decompose(to, ct);
  16. continue;
  17. }
  18. decompose(to, ct);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement