Skip to content

Commit 47e92f6

Browse files
committed
nits
1 parent 3d246c7 commit 47e92f6

File tree

1 file changed

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

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff 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
};
3228
template<> struct KD_SEG<0> {

0 commit comments

Comments
 (0)