Skip to content

Commit c4c4d0d

Browse files
authored
Fix calculation in nxt function in seg_tree.hpp
1 parent ceca350 commit c4c4d0d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/data_structures_[l,r]/seg_tree.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! @space O(n)
1313
int nxt(int& l, int r) {
1414
int x = __lg(min(l & -l, r - l + 1));
15-
return (l += (1 << x)) >> x - 1;
15+
return ((l += (1 << x)) >> x) - 1;
1616
//return exchange(l, l + (1 << x)) >> x;
1717
}
1818
template<class T, class F> struct tree {

0 commit comments

Comments
 (0)