diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-05-02 22:18:05 +0200 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-05-02 22:18:05 +0200 |
| commit | 2ff696b7a72f484f435ffc37dcacedb6fa434b3b (patch) | |
| tree | cae8bed3e7fecb61f6d0aec582bea5466ea5939b /datastructures/fenwickTree.cpp | |
| parent | 2ecbcca9952475c40bfd2a936b7631b236dfc922 (diff) | |
remove sz() from Fenwick trees
Diffstat (limited to 'datastructures/fenwickTree.cpp')
| -rw-r--r-- | datastructures/fenwickTree.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/datastructures/fenwickTree.cpp b/datastructures/fenwickTree.cpp index 6c5ed91..8c73b78 100644 --- a/datastructures/fenwickTree.cpp +++ b/datastructures/fenwickTree.cpp @@ -1,15 +1,15 @@ vector<ll> tree; void update(int i, ll val) { - for (i++; i < sz(tree); i += (i & (-i))) tree[i] += val; + for (i++; i < ssize(tree); i += i & -i) tree[i] += val; } void init(int n) { - tree.assign(n + 1,0); + tree.assign(n + 1, 0); } ll prefix_sum(int i) { ll sum = 0; - for (; i > 0; i -= (i & (-i))) sum += tree[i]; + for (; i > 0; i -= i & -i) sum += tree[i]; return sum; } |
