-
Add the same value to a range of arrays
- where s: start, e: end
- This query is done Q times
- O(NQ) when implemented naively.
- Add only the beginning and end of the range first.
- Then take the cumulative sum and you get the same thing: O(N+Q)
- Itβs like calculating in derivative form and then integrating at the end.
-
imos law - imos laboratory (imos laboratory)
-
cumulative sum algorithm extended to multi-dimensional and multi-order
-
https://maspypy.com/atcoder-εε ζζ³-2019-02-16abc-155
This page is auto-translated from /nishio/γγγζ³ using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. Iβm very happy to spread my thought to non-Japanese readers.