MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / range_update

Function range_update

code/data-structures/fenwick_tree.cpp:21–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 int query(int x) { return x*x1.query(x) + x0.query(x); }
20};
21void range_update(fenwick_tree_sq &s, int a, int b, int k) {
22 s.update(a, k, k * (1 - a)); s.update(b+1, -k, k * b); }
23int range_query(fenwick_tree_sq &s, int a, int b) {
24 return s.query(b) - s.query(a-1); }
25// vim: cc=60 ts=2 sts=2 sw=2:

Callers 2

test2Function · 0.85
range_updateMethod · 0.85

Calls 1

updateMethod · 0.45

Tested by 1

test2Function · 0.68