File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
library/data_structures_[l,r)/seg_tree_uncommon Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,8 @@ template<int K> struct KD_SEG {
88 KD_SEG (int n, auto ... a):
99 n (n), s(2 * n, KD_SEG<K - 1 >(a...)) {}
1010 void update (int p, auto ... a) {
11- p += n;
12- s[p].update (a...);
13- for (; p /= 2 ;)
14- s[p].pull (s[2 * p], s[2 * p + 1 ], a...);
11+ s[p += n].update (a...);
12+ while (p /= 2 ) s[p].pull (s[2 * p], s[2 * p + 1 ], a...);
1513 }
1614 T query (int l, int r, auto ... a) {
1715 T x = unit, y = unit;
@@ -23,10 +21,8 @@ template<int K> struct KD_SEG {
2321 }
2422 void pull (const KD_SEG<K>& left, const KD_SEG<K>& right,
2523 int p, auto ... a) {
26- p += n;
27- s[p].pull (left.s [p], right.s [p], a...);
28- for (; p /= 2 ;)
29- s[p].pull (s[2 * p], s[2 * p + 1 ], a...);
24+ s[p += n].pull (left.s [p], right.s [p], a...);
25+ while (p /= 2 ) s[p].pull (s[2 * p], s[2 * p + 1 ], a...);
3026 }
3127};
3228template <> struct KD_SEG <0 > {
You can’t perform that action at this time.
0 commit comments