Skip to content

Commit 61807f0

Browse files
committed
actually I like these var names better
1 parent fb8520a commit 61807f0

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

library/data_structures/uncommon/linear_rmq.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ template<class T, class F> struct linear_rmq {
2424
while (sz(st) > 1 &&
2525
(i == n || !cmp(a[st.back()], a[i]))) {
2626
head[prev] = st.back();
27-
auto k = end(st)[-2] + 1u, b = bit_floor(k ^ i);
28-
in[st.back()] = prev = i & -b, asc[k] |= b;
27+
auto j = end(st)[-2] + 1u, k = bit_floor(i ^ j);
28+
in[st.back()] = prev = i & -k, asc[j] |= k;
2929
st.pop_back();
3030
}
3131
st.push_back(head[prev] = i);
@@ -34,12 +34,12 @@ template<class T, class F> struct linear_rmq {
3434
(asc[i] | asc[i - 1]) & -(in[i] & -in[i]);
3535
}
3636
int idx(int l, int r) { // [l, r]
37-
if (unsigned i = in[l] ^ in[r]; i) {
38-
i = asc[l] & asc[r] & -bit_floor(i);
39-
if (unsigned b = asc[l] ^ i; b)
40-
b = bit_floor(b), l = head[(in[l] & -b) | b];
41-
if (unsigned b = asc[r] ^ i; b)
42-
b = bit_floor(b), r = head[(in[r] & -b) | b];
37+
if (unsigned j = in[l] ^ in[r]; j) {
38+
j = asc[l] & asc[r] & -bit_floor(j);
39+
if (unsigned k = asc[l] ^ j; k)
40+
k = bit_floor(k), l = head[(in[l] & -k) | k];
41+
if (unsigned k = asc[r] ^ j; k)
42+
k = bit_floor(k), r = head[(in[r] & -k) | k];
4343
}
4444
return cmp(a[l], a[r]) ? l : r;
4545
}

library/trees/linear_kth_par.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ template<int KAPPA = 2> struct linear_kth_par {
4141
int kth_par(int v, int k) {
4242
assert(0 <= k && k <= d[v]);
4343
int anc_d = d[v] - k;
44-
if (unsigned b = k / (KAPPA + 1); b)
45-
b = bit_floor(b), v = jmp[(pos[v] & -b) | b];
44+
if (unsigned j = k / (KAPPA + 1); j)
45+
j = bit_floor(j), v = jmp[(pos[v] & -j) | j];
4646
return v = leaf[v], lad[v][d[v] - anc_d];
4747
}
4848
};

library/trees/linear_lca.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ struct linear_lca {
2828
for (auto [v, p] : order) asc[v] = asc[p] | lsb(in[v]);
2929
}
3030
int lca(int u, int v) {
31-
if (unsigned i = in[u] ^ in[v]; i) {
32-
i = asc[u] & asc[v] & -bit_floor(i);
33-
if (unsigned b = asc[u] ^ i; b)
34-
b = bit_floor(b), u = head[(in[u] & -b) | b];
35-
if (unsigned b = asc[v] ^ i; b)
36-
b = bit_floor(b), v = head[(in[v] & -b) | b];
31+
if (unsigned j = in[u] ^ in[v]; j) {
32+
j = asc[u] & asc[v] & -bit_floor(j);
33+
if (unsigned k = asc[u] ^ j; k)
34+
k = bit_floor(k), u = head[(in[u] & -k) | k];
35+
if (unsigned k = asc[v] ^ j; k)
36+
k = bit_floor(k), v = head[(in[v] & -k) | k];
3737
}
3838
return d[u] < d[v] ? u : v;
3939
}

0 commit comments

Comments
 (0)