We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f6607a3 commit db7b0d5Copy full SHA for db7b0d5
library/data_structures_[l,r]/seg_tree.hpp
@@ -25,8 +25,8 @@ template<class T, class F> struct tree {
25
s[i] = op(s[2 * i], s[2 * i + 1]);
26
}
27
T query(int l, int r) {
28
- T res = s[nxt(l += n, r += n)];
29
- while (l <= r) res = op(res, s[nxt(l, r)]);
30
- return res;
+ T x = s[nxt(l += n, r += n)];
+ while (l <= r) x = op(x, s[nxt(l, r)]);
+ return x;
31
32
};
0 commit comments