We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9c3d72 commit 1c1d65eCopy full SHA for 1c1d65e
library/data_structures_[l,r]/seg_tree.hpp
@@ -11,8 +11,8 @@
11
//! @time O(n + q log n)
12
//! @space O(n)
13
int nxt(int& l, int r) {
14
- int x = __lg(min(l & -l, r - l + 1));
15
- return ((l += (1 << x)) >> x) - 1;
+ int x = __lg(min(l & -l, r - l + 1)), y = l;
+ return l += (1 << x), y >> x;
16
//return exchange(l, l + (1 << x)) >> x;
17
}
18
template<class T, class F> struct tree {
0 commit comments