From 33cef907fd5addeaebd7f846bc361f00f3856557 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Tue, 5 Aug 2025 17:30:21 -0600 Subject: [PATCH] naming consistency --- library/data_structures/uncommon/linear_rmq.hpp | 12 ++++++------ library/trees/linear_lca.hpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library/data_structures/uncommon/linear_rmq.hpp b/library/data_structures/uncommon/linear_rmq.hpp index d7f05ea3..3a04d6c6 100644 --- a/library/data_structures/uncommon/linear_rmq.hpp +++ b/library/data_structures/uncommon/linear_rmq.hpp @@ -34,12 +34,12 @@ template struct linear_rmq { (asc[i] | asc[i - 1]) & -(in[i] & -in[i]); } int idx(int l, int r) { // [l, r] - if (unsigned j = in[l] ^ in[r]; j) { - j = asc[l] & asc[r] & -bit_floor(j); - if (unsigned k = asc[l] ^ j; k) - k = bit_floor(k), l = head[(in[l] & -k) | k]; - if (unsigned k = asc[r] ^ j; k) - k = bit_floor(k), r = head[(in[r] & -k) | k]; + if (unsigned i = in[l] ^ in[r]; i) { + i = asc[l] & asc[r] & -bit_floor(i); + if (unsigned b = asc[l] ^ i; b) + b = bit_floor(b), l = head[(in[l] & -b) | b]; + if (unsigned b = asc[r] ^ i; b) + b = bit_floor(b), r = head[(in[r] & -b) | b]; } return cmp(a[l], a[r]) ? l : r; } diff --git a/library/trees/linear_lca.hpp b/library/trees/linear_lca.hpp index 853d40dd..5f513b73 100644 --- a/library/trees/linear_lca.hpp +++ b/library/trees/linear_lca.hpp @@ -32,12 +32,12 @@ struct linear_lca { for (auto [v, p] : order) asc[v] = asc[p] | lsb(in[v]); } int lca(int u, int v) { - if (unsigned j = in[u] ^ in[v]; j) { - j = asc[u] & asc[v] & -bit_floor(j); - if (unsigned k = asc[u] ^ j; k) - k = bit_floor(k), u = head[(in[u] & -k) | k]; - if (unsigned k = asc[v] ^ j; k) - k = bit_floor(k), v = head[(in[v] & -k) | k]; + if (unsigned i = in[u] ^ in[v]; i) { + i = asc[u] & asc[v] & -bit_floor(i); + if (unsigned b = asc[u] ^ i; b) + b = bit_floor(b), u = head[(in[u] & -b) | b]; + if (unsigned b = asc[v] ^ i; b) + b = bit_floor(b), v = head[(in[v] & -b) | b]; } return d[u] < d[v] ? u : v; }