Skip to content

Commit dcfa30f

Browse files
committed
another golf
1 parent 312d08f commit dcfa30f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/data_structures/uncommon/linear_rmq.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ template<class T, class F> struct linear_rmq {
2020
n(sz(a)), a(a), cmp(cmp), asc(n), in(n), head(n + 1) {
2121
vi st{-1};
2222
rep(i, 0, n + 1) {
23-
int prev = -1;
23+
int prev = 0;
2424
while (sz(st) > 1 &&
2525
(i == n || !cmp(a[st.back()], a[i]))) {
26-
if (prev != -1) head[prev] = st.back();
26+
if (prev) head[prev] = st.back();
2727
int b = bit_floor((end(st)[-2] + 1u) ^ i);
2828
in[st.back()] = prev = i & -b;
2929
st.pop_back();
3030
asc[st.back() + 1] |= b;
3131
}
32-
if (prev != -1) head[prev] = i;
32+
if (prev) head[prev] = i;
3333
st.push_back(i);
3434
}
3535
rep(i, 1, n)(asc[i] |= asc[i - 1]) &=

0 commit comments

Comments
 (0)