Skip to content

Commit 1d752d6

Browse files
ia7ckCopilot
andauthored
連結成分数が減ることがわかった後に groups を変更する
Co-authored-by: Copilot <[email protected]>
1 parent 7a35a7a commit 1d752d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libs/union_find/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ impl UnionFind {
9191
return None;
9292
}
9393

94-
self.groups -= 1;
9594
match (self.nodes[i], self.nodes[j]) {
9695
(NodeKind::Root { size: i_size }, NodeKind::Root { size: j_size }) => {
96+
self.groups -= 1;
9797
let total = i_size + j_size;
9898
// マージテク
9999
if i_size >= j_size {

0 commit comments

Comments
 (0)