From cd870938f6cf266292e0e5cecb2d96d604b2ad9d Mon Sep 17 00:00:00 2001 From: Gloria Mundi Date: Sun, 10 Mar 2024 20:48:51 +0100 Subject: make Fenwick Tree prefix sum exclusive --- datastructures/fenwickTree2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'datastructures/fenwickTree2.cpp') 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& 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; -- cgit v1.2.3