Luogu P6587 \color{green}{\texttt{Luogu P6587}} Luogu P6587
[Problem] \color{blue}{\texttt{[Problem]}} [Problem]
给定一个长度为 n n n 的序列 a a a,执行以下两个操作 m m m 次:
- 给定 x , y , v x,y,v x,y,v,将所有 a i a_{i} ai 加上 v v v,其中 i i i 满足 i ≡ y ( m o d 2 x ) i \equiv y \pmod {2^{x}} i≡y(mod2x)。
- 给定 x , y x,y x,y,求出所有 a i a_{i} ai 的总和,其中 i i i 满足 i ≡ y ( m o d 2 x ) i \equiv y \pmod {2^{x}} i≡y(mod2x)。
1 ≤ n , m ≤ 2 × 1 0 5 , 0 ≤ x ≤ 20 , 0 ≤ y < 2 x 1 \leq n,m \leq 2 \times 10^{5},0 \leq x \leq 20,0 \leq y < 2^{x} 1≤n,m≤2×