We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e307c45 commit d0cf278Copy full SHA for d0cf278
library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp
@@ -2,8 +2,8 @@ int walk(int l, int r, const auto& f) {
2
for (l += n, r += n; l <= r;)
3
if (int u = nxt(l, r); f(s[u])) {
4
while (u < n)
5
- if (f(s[2 * u])) u = 2 * u;
6
- else u = 2 * u + 1;
+ if (f(s[2 * u])) u *= 2;
+ else (u *= 2)++;
7
return u - n;
8
}
9
return -1;
0 commit comments