diff --git a/content/data-structures/FenwickTree.h b/content/data-structures/FenwickTree.h index 7caa5f512..c3becb233 100644 --- a/content/data-structures/FenwickTree.h +++ b/content/data-structures/FenwickTree.h @@ -27,7 +27,7 @@ struct FT { int pos = 0; for (int pw = 1 << 25; pw; pw >>= 1) { if (pos + pw <= sz(s) && s[pos + pw-1] < sum) - pos += pw, sum -= s[pos-1]; + sum -= s[(pos+=pw)-1]; } return pos; }