问题 J: Easy problem I

内存限制:512 MB 时间限制:9 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:7 通过:2

题目描述

note:The difference is that in this version,operation 11 is different,�,�≤2×105n,m2×105,��≤��+1xjxj+1.

For a given sequence of n intergers a.

There are two types of operations:

1����(1≤�≤�≤�)1lrxj(1lrn) — for each �∈[�,�]i[l,r] ,change ��=∣��−��∣ai=aixj.

2��(1≤�≤�≤�)2lr(1lrn) — output ans=∑�=����ans=i=lrai

tips:Due to the large input data, it may be necessary to FastIO.

输入格式

The input consists of multiple test cases. The first line contains a single integer �(1≤�≤5)T(1T5) — the number of test cases.

The first line of each test case contains two integers n and �,(1≤�≤2×105,1≤�≤2×105)m,(1n2×105,1m2×105) — the length of sequence and the number of operations.

The next line contains n integer ��ai (0≤��≤107)(0ai107)

The next m line contains some integers ���,�,�,�opt,l,r,x (1≤���≤2,1≤�≤�≤�,0≤�≤107)(1opt2,1lrn,0x107) — indicating the operations.

输出格式

For each query, output an interger in a single line indicating the ansans.

输入样例 复制

1
5 5
1 2 3 4 5
1 1 5 3
2 1 2
2 2 4
1 2 3 5
2 1 5

输出样例 复制

3
2
14

分类标签