Skip to content

Commit 9b0dd36

Browse files
committed
nits
1 parent 4623957 commit 9b0dd36

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
int count(int l, int r, ll ub) {
66
int res = 0;
77
for (int h = sz(bv); h--;) {
8-
int l0 = bv[h].cnt(l), r0 = bv[h].cnt(r);
9-
if ((~ub >> h) & 1) l = l0, r = r0;
10-
else
11-
res += r0 - l0, l += bv[h].cnt(n) - l0,
12-
r += bv[h].cnt(n) - r0;
8+
int x = bv[h].cnt(l), y = bv[h].cnt(r);
9+
if ((ub >> h) & 1)
10+
res += y - x, l += bv[h].cnt(n) - x,
11+
r += bv[h].cnt(n) - y;
12+
else l = x, r = y;
1313
}
1414
return res;
1515
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ struct wavelet_matrix {
2525
ll kth(int l, int r, int k) {
2626
ll res = 0;
2727
for (int h = sz(bv); h--;) {
28-
int l0 = bv[h].cnt(l), r0 = bv[h].cnt(r);
29-
if (k < r0 - l0) l = l0, r = r0;
28+
int x = bv[h].cnt(l), y = bv[h].cnt(r);
29+
if (k < y - x) l = x, r = y;
3030
else
31-
k -= r0 - l0, res |= 1LL << h,
32-
l += bv[h].cnt(n) - l0, r += bv[h].cnt(n) - r0;
31+
k -= y - x, res += 1LL << h, l += bv[h].cnt(n) - x,
32+
r += bv[h].cnt(n) - y;
3333
}
3434
return res;
3535
}

0 commit comments

Comments
 (0)