We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d804734 commit 47be752Copy full SHA for 47be752
solutions/gold/cf-468B.mdx
@@ -34,7 +34,7 @@ We can treat each set as a graph with several connected components. For each $p_
34
#include <bits/stdc++.h>
35
using namespace std;
36
37
-// BeginCodeSnip{DSU}
+// BeginCodeSnip{DSU (from the module)}
38
class DSU {
39
private:
40
vector<int> parents;
@@ -45,12 +45,10 @@ class DSU {
45
for (int i = 0; i < size; i++) { parents[i] = i; }
46
}
47
48
- /** @return the "representative" node in x's component */
49
int get(int x) {
50
return parents[x] == x ? x : (parents[x] = get(parents[x]));
51
52
53
- /** @return whether the merge changed connectivity */
54
bool unite(int x, int y) {
55
int x_root = find(x);
56
int y_root = find(y);
0 commit comments