当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6967:I love data structure

题目描述
This is a simple data structure problem.

In this problem, you need to maintain a sequence of numbers. Each position of the sequence has two parameters $a$ and $b$.

Now there are $m$ operations, and these operations can be divided into four types.

Type 1: Given interval $(l, r)$ and $x$, and mark 0/1 represents $a$ parameter or $b$ parameter, for each position in the interval, add $x$ to the $a$ parameter or $b$ parameter at this position.

Type 2: Given interval $(l, r)$, for each position in the interval, the $a$ parameter of this position becomes $3a+2b$, and the $b$ parameter becomes $3a-2b$.For example, originally $a=1$, $b=2$, after the operation becomes $a=7$, $b=-1$.

Type 3: Given interval $(l, r)$, for each position in the interval, exchange the two parameters $a$, $b$ corresponding to this position.

Type 4: Given interval $(l,r)$, query$\sum_{i=l}^ra_i*b_i$

This question is very simple, can you finish it?
输入解释
There is only one test case for this question.

In the first line, a positive integer $n$ ($n \leq 200000$) represents the length of the sequence.

In the next $n$ lines, the i-th line have two numbers in each line to represent the two parameters $a_i$ and $b_i$($1 \leq a_i,b_i \leq 1000000000$) at each position

In the next line, a positive integer $q$ ($q \leq 200000$) represents the number of operations.

For the next $q$ lines

$1$ $tag$ $l$ $r$ $x$($0 \leq tag \leq 1,1 \leq x \leq 1000000000$)means $a$ or $b$ plus $x$ in every position of this interval

$2$ $l$ $r$ Let $a$ become $3a+2b$ and $b$ become $3a-2b$ in every position of this interval

$3$ $l$ $r$ exchange the weight of $a$ and $b$ in every position of this interval

$4$ $l$ $r$ Query the sum of value of $a*b$ in every position of this interval
输出解释
For each type $4$ query, output a line of a positive integer to represent the result of the query, and the answer is modulo $1000000007$.
输入样例
5
1 4
3 2
4 1
3 6
7 3
6
1 0 2 4 2
2 2 4
4 1 4
3 3 5
1 1 4 5 3
4 1 4
输出样例
614
623

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6967

最后修改于 2021-10-23T19:10:51+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/5000MS(Java/Others) 262144/262144K(Java/Others)