From 5ecd764a1312c8f802fc4a11972826d6f8986ef4 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Thu, 15 Jan 2026 10:17:44 -0700 Subject: [PATCH 1/2] change --- library/data_structures/dsu/dsu.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/data_structures/dsu/dsu.hpp b/library/data_structures/dsu/dsu.hpp index dc7e99dd..e3f2b5de 100644 --- a/library/data_structures/dsu/dsu.hpp +++ b/library/data_structures/dsu/dsu.hpp @@ -1,13 +1,13 @@ #pragma once // NOLINTNEXTLINE(readability-identifier-naming) struct DSU { - vi e; - DSU(int n): e(n, -1) {} - int size(int x) { return -e[go(x)]; } - int go(int x) { return e[x] < 0 ? x : e[x] = go(e[x]); } + vi p; + DSU(int n): p(n, -1) {} + int size(int x) { return -p[go(x)]; } + int go(int x) { return p[x] < 0 ? x : p[x] = go(p[x]); } bool join(int a, int b) { if ((a = go(a)) == (b = go(b))) return 0; - if (e[a] > e[b]) swap(a, b); - return e[a] += e[b], e[b] = a, 1; + if (p[a] > p[b]) swap(a, b); + return p[a] += p[b], p[b] = a, 1; } }; From 3fb447eaec7c6b69fe10ff6ac3b98557e76c5211 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Thu, 15 Jan 2026 10:20:40 -0700 Subject: [PATCH 2/2] fix --- .../graphs/offline_incremental_scc.test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp b/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp index 7edac3e1..306f35ac 100644 --- a/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp +++ b/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp @@ -27,7 +27,7 @@ int main() { auto [u, v] = eds[order[it]]; u = dsu.go(u); v = dsu.go(v); - if (dsu.e[u] > dsu.e[v]) swap(u, v); + if (dsu.p[u] > dsu.p[v]) swap(u, v); if (u != v) { sum = (sum + 1LL * xs[u] * xs[v]) % mod; xs[u] = (xs[u] + xs[v]) % mod;