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

建议使用的浏览器:

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

6367:foam-transformation

题目描述
Operation "T" on array "a" with length at m has following description:

T i k, which holds $1 \le i < m$, i,k are both integers,denotes that $a_i+=1*(-1)^k,a_{i+1}+=4*(-1)^k,..,a_{i+j}+=(j+1)^2*(-1)^k,...,a_{m}+=(m-i+1)^2*(-1)^k$.

A array $a$ with length $n$ is "acid" if and only if :

1. If we add $5$ zero elements at the end of $a$ (length is $n + 5$ now).

2. After 1, we can use finite operation "T" on a to make a become all zero array.

The "acidity" of a array "a" is the number of nonempty subintervals which is "acid".

(more formally, the number of pairs (l,r) satisfying $a_{l},a_{l+1}...a_{r}$ is "acid",$1 \le l \le r \le length(a)$)

Now,you are given an integer $n$ and an array "a" consisting $n$ integers.You should maintain the "acidity" of the array dynamicly.

Given an integer m, following m operations like that:

U i x, denoting $a_i+=x,a_{i+1}+=x,1 \le i < n.$

You should output an answer before all operations,

Then print one more answer after each operation denoting the dynamic "acidity".

Yes, as the writer is too lazy, we didn't encrypt the input data in any way, help yourself if you can solve this problem by some off line way :)
输入解释
The first line contain a integer $T$ (no morn than 10), the following is $T$ test case, for each test case :

The first line,two integers n and m, satisfying $2 \le n \le 100000,1 < m \le 100000$.

The second line consists n integers whose absolute values are not greater than 100000.

Next m lines,each would be shown like U i x,$1 \le i < n,|x| \le 100000$,which denotes a modifying operation.
输出解释
Print m+1 answers one perline denoting the dynamic "acidity" of the given array.
输入样例
1
20 10
-63541 0 -59055 -41170 0 0 0 -21343 25072 0 -76818 -59156 0 4435 59829 0 0 -56094 0 0
U 5 -62470
U 13 -52045
U 18 95988
U 13 -76265
U 7 35037
U 6 -41898
U 8 -71979
U 18 48427
U 16 -4208
U 15 34206
输出样例
15
12
11
9
9
7
6
6
6
4
3
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6367

最后修改于 2020-10-25T23:30:42+00:00 由爬虫自动更新

共提交 0

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