diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-03-10 20:48:51 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-03-10 20:48:51 +0100 |
| commit | cd870938f6cf266292e0e5cecb2d96d604b2ad9d (patch) | |
| tree | a1615ad3cac2c505c33e9952fc72cced5931d6c9 /datastructures/fenwickTree2.cpp | |
| parent | 0cebc901e79c21168601071e29ed8e4f4b6f9505 (diff) | |
make Fenwick Tree prefix sum exclusive
Diffstat (limited to 'datastructures/fenwickTree2.cpp')
| -rw-r--r-- | datastructures/fenwickTree2.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/datastructures/fenwickTree2.cpp b/datastructures/fenwickTree2.cpp index ff87e2e..43c3a32 100644 --- a/datastructures/fenwickTree2.cpp +++ b/datastructures/fenwickTree2.cpp @@ -14,7 +14,7 @@ void init(vector<ll>& v) { } ll prefix_sum (int i) { - ll res = 0; i++; + ll res = 0; for (int ti = i; ti > 0; ti -= ti&(-ti)) res += add[ti] * i + mul[ti]; return res; |
