We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dcfa30f commit c7f4999Copy full SHA for c7f4999
1 file changed
library/data_structures/uncommon/linear_rmq.hpp
@@ -23,13 +23,13 @@ template<class T, class F> struct linear_rmq {
23
int prev = 0;
24
while (sz(st) > 1 &&
25
(i == n || !cmp(a[st.back()], a[i]))) {
26
- if (prev) head[prev] = st.back();
+ head[prev] = st.back();
27
int b = bit_floor((end(st)[-2] + 1u) ^ i);
28
in[st.back()] = prev = i & -b;
29
st.pop_back();
30
asc[st.back() + 1] |= b;
31
}
32
- if (prev) head[prev] = i;
+ head[prev] = i;
33
st.push_back(i);
34
35
rep(i, 1, n)(asc[i] |= asc[i - 1]) &=
0 commit comments