Skip to content

Commit 5ecd764

Browse files
committed
change
1 parent 1979621 commit 5ecd764

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#pragma once
22
// NOLINTNEXTLINE(readability-identifier-naming)
33
struct DSU {
4-
vi e;
5-
DSU(int n): e(n, -1) {}
6-
int size(int x) { return -e[go(x)]; }
7-
int go(int x) { return e[x] < 0 ? x : e[x] = go(e[x]); }
4+
vi p;
5+
DSU(int n): p(n, -1) {}
6+
int size(int x) { return -p[go(x)]; }
7+
int go(int x) { return p[x] < 0 ? x : p[x] = go(p[x]); }
88
bool join(int a, int b) {
99
if ((a = go(a)) == (b = go(b))) return 0;
10-
if (e[a] > e[b]) swap(a, b);
11-
return e[a] += e[b], e[b] = a, 1;
10+
if (p[a] > p[b]) swap(a, b);
11+
return p[a] += p[b], p[b] = a, 1;
1212
}
1313
};

0 commit comments

Comments
 (0)