#P10061. [CF266E]More Queries to Array
[CF266E]More Queries to Array
题面翻译
一段序列
两种操作:
表示将区间的值赋为
表示输出
Translated by @Fheiwn
题目描述
You've got an array, consisting of integers: . Your task is to quickly run the queries of two types:
- Assign value to all elements from to inclusive. After such query the values of the elements of array become equal to .
- Calculate and print sum
, where doesn't exceed . As the value of the sum can be rather large, you should print it modulo .
输入格式
The first line contains two integers and ( ), showing, how many numbers are in the array and the number of queries, correspondingly. The second line contains integers: ( ) — the initial values of the array elements.
Then queries follow, one per line:
- The assign query has the following format: "
", ( ).
- The query to calculate the sum has the following format: "
", ( ).
All numbers in the input are integers.
输出格式
For each query to calculate the sum print an integer — the required sum modulo .
样例 #1
样例输入 #1
4 5
5 10 2 1
? 1 2 1
= 2 2 0
? 2 4 3
= 1 4 1
? 1 4 5
样例输出 #1
25
43
1300
样例 #2
样例输入 #2
3 1
1000000000 1000000000 1000000000
? 1 3 0
样例输出 #2
999999986