diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-06-23 01:13:23 +0200 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-06-23 01:13:23 +0200 |
| commit | a6e8d68a9b406027f48fb81cae6cf13d073ffa5a (patch) | |
| tree | f80b7e855666a6e092534016972e97ee30a6e65e /datastructures/fenwickTree.cpp | |
| parent | 7f040b63d7581985b399d7eab1762b0951f49dde (diff) | |
simplify fenwick tree
Diffstat (limited to 'datastructures/fenwickTree.cpp')
| -rw-r--r-- | datastructures/fenwickTree.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/datastructures/fenwickTree.cpp b/datastructures/fenwickTree.cpp index 8c73b78..7013613 100644 --- a/datastructures/fenwickTree.cpp +++ b/datastructures/fenwickTree.cpp @@ -10,6 +10,6 @@ void init(int n) { ll prefix_sum(int i) { ll sum = 0; - for (; i > 0; i -= i & -i) sum += tree[i]; + for (; i > 0; i &= i-1) sum += tree[i]; return sum; } |
