summaryrefslogtreecommitdiff
path: root/datastructures/fenwickTree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'datastructures/fenwickTree.cpp')
-rw-r--r--datastructures/fenwickTree.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/datastructures/fenwickTree.cpp b/datastructures/fenwickTree.cpp
index cac3cf8..7013613 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++; i > 0; i -= (i & (-i))) sum += tree[i];
+ for (; i > 0; i &= i-1) sum += tree[i];
return sum;
}