Skip to content

Commit b6d244f

Browse files
committed
modify code
1 parent 1a73475 commit b6d244f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/class174/Code03_ColorfulWorld1.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,20 @@ public class Code03_ColorfulWorld1 {
4646
// 查询的答案
4747
public static int[] ans = new int[MAXM];
4848

49+
// 查询x值变成了什么
4950
public static int find(int x) {
5051
if (x != fa[x]) {
5152
fa[x] = find(fa[x]);
5253
}
5354
return fa[x];
5455
}
5556

57+
// 所有x值变成y值
5658
public static void union(int x, int y) {
5759
fa[find(x)] = find(y);
5860
}
5961

62+
// 根据值域并查集的修改结果,把修改写入arr[l..r]
6063
public static void down(int l, int r) {
6164
for (int i = l; i <= r; i++) {
6265
arr[i] = find(arr[i]);

0 commit comments

Comments
 (0)