标签:play class 区间查询 spl str 区间修改 树状 splay isp
\[SUM[x,y]=\sum_{i = 1}^{x}\sum_{j = 1}^{y}\sum_{k = 1}^{i}\sum_{l = 1}^{j}b[k][l]\] \[=\sum_{i = 1}^{x}\sum_{j = 1}^{y}(x - i + 1)(y - j + 1)b[i][j]\]把有关 \(i, j\) 的丢到一边, 展开化简得
\[(xy + x + y + 1)\sum_{i = 1}^{x}\sum_{j = 1}^{y}d[i][j] - (x +1)\sum_{i = 1}^{x}\sum_{j = 1}^{y}j * d[i][j] - (y + 1)\sum_{i = 1}^{x}\sum_{j = 1}^{y}i * d[i][j] + \sum_{i = 1}^{x}\sum_{j = 1}^{y}ij * d[i][j]\]
所以, 我们维护 \(d[i][j], d[i][j] * i, d[i][j] * j, d[i][j] * i * j\) 这四个前缀和即可 二维树状数组区间修改区间查询
标签:play class 区间查询 spl str 区间修改 树状 splay isp
原文地址:https://www.cnblogs.com/Tony-Double-Sky/p/9585981.html