GSS8 - Can you answer these queries VIII

题意翻译

# 题目描述 给你一个序列,$A[0], A[1]...A[N - 1]. (0 \le A[i] \lt 2^{32})$ 你需要支持$Q$次操作 1. `I pos val` 插入一个数字在第$pos$个位置之前,$0 \le val \lt 2^{32}$, 如果$pos=current_{length}$,那么你需要将这个数字放到序列末尾 2. `D pos` 删除第$pos$个元素 3. `R pos val` 将第$pos$个元素变为$val(0 \le val \lt 2^{32})$ 4. `Q l r k` 询问$(\sum\limits_{i=l}^{r} A[i] * (i - l + 1) ^ k) \mod 2^{32}$,保证$0 \le k \le 10$ 第一行一个正整数 $n$,接下来一行 $n$ 个整数,表示 $a_0,a_1...a_{n-1}$。 第三行一个整数 $q$,表示操作个数。 接下来 $q$ 行,每行表示一个操作。 数据点保证: $1\le n \le 10^5$ $0 \le q \le 10^5$

题目描述

You are given sequence A\[0\], A\[1\]...A\[N - 1\]. (0 <= A\[i\] < 2^32) You are to perform Q operations: 1\. **I pos val**, insert number **val** in sequence before element with index **pos**. (0 <= val < 2^32, if **pos** = **current\_length** then you should add number to the end of the sequence) 2\. **D pos**, delete element with index **pos** from sequence. 3\. **R pos val**, replace element with idex **pos** by **val**. (0 <= val < 2^32) 4\. **Q l r k**, answer Σ A\[i\] \* (i - l + 1)^k modulo 2^32, for l <= i <= r. (0 <= k <= 10)

输入输出格式

输入格式


输出格式


输入输出样例

输入样例 #1

4
1 2 3 5
7
Q 0 2 0
I 3 4
Q 2 4 1
D 0
Q 0 3 1
R 1 2
Q 0 1 0

输出样例 #1

6
26
40
4