Skip to content

Commit 780363b

Browse files
committed
more golf
1 parent 0084dcf commit 780363b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

library/data_structures/uncommon/linear_rmq.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ 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-
int b = bit_floor((end(st)[-2] + 1u) ^ i);
27+
auto k = end(st)[-2] + 1u, b = bit_floor(k ^ i);
2828
in[st.back()] = prev = i & -b;
29+
asc[k] |= b;
2930
st.pop_back();
30-
asc[st.back() + 1] |= b;
3131
}
32-
head[prev] = i;
33-
st.push_back(i);
32+
st.push_back(head[prev] = i);
3433
}
3534
rep(i, 1, n) asc[i] =
3635
(asc[i] | asc[i - 1]) & -(in[i] & -in[i]);

0 commit comments

Comments
 (0)