Skip to content

Commit ed045ea

Browse files
authored
Fix order of operations in walk function
1 parent f2c0738 commit ed045ea

File tree

1 file changed

+1
-1
lines changed
  • library/data_structures_[l,r)/seg_tree_uncommon

1 file changed

+1
-1
lines changed

library/data_structures_[l,r)/seg_tree_uncommon/walk.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
int walk(int l, int r, const auto& f) {
22
for (T x = unit; l < r;) {
33
int u = l + n, v = __lg(min(u & -u, r - l));
4-
if (T y = op(x, s[u >> v]); f(y)) x = y, l += 1 << v;
4+
if (T y = op(x, s[u >> v]); f(y)) l += 1 << v, x = y;
55
else r = l + (1 << v) - 1;
66
}
77
return l;

0 commit comments

Comments
 (0)