Skip to content

Commit 357c621

Browse files
committed
add links
1 parent a72baa0 commit 357c621

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

copypasta/union_find.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ func unionFind(n int) {
150150
// 并查集 - 维护点权
151151
// 维护的可以是集合的大小、最值、XOR、GCD 等
152152
// https://codeforces.com/edu/course/2/lesson/7/1/practice/contest/289390/problem/B
153+
// https://codeforces.com/problemset/problem/1609/D
153154
// LC 周赛 203D https://leetcode-cn.com/contest/weekly-contest-203/problems/find-latest-group-of-size-m/
154155
func unionFindVertexWeight(n int) {
155156
var fa, sz []int
@@ -173,6 +174,7 @@ func unionFindVertexWeight(n int) {
173174
from, to = find(from), find(to)
174175
if from != to {
175176
sz[to] += sz[from]
177+
//sz[from] = 0 // 有些题目需要保证总 sz 和不变(如 CF1609D)
176178
fa[from] = to
177179
}
178180
}

0 commit comments

Comments
 (0)