2632. [HZOI 2016] d series operation
★★★ Input file: segment.in
Output file: segment.out
a simple comparison of
the time limit: 3 s memory limit: 512 MB
Description [title]
A length n of the sequence, a sequence beginning weights are number 0 , there are m operations
It supports two modes of operation:
1 LR x, to the interval [L, R] position plus the number of pos (pos-L) * x
In weight and 0 LR, inquiry interval [L, R]
The final answer to 10 . 9 + 7 mod.
[Input Format]
The first line of the two numbers n, m, represents the sequence length and the number of operations
Subsequently m rows, each row describes an operation, the following two situations:
1 LR x, to the interval [L, R] position plus the number of pos ( P O S - L ) × X
In weight and 0 LR, inquiry interval [L, R]
[Output format]
Each an integer 0 output operation mode 10 . 9 + 7
[Sample input]
5 5 0 2 3 1 4 5 1 1 1 5 5 0 1 4 0 2 3
[Sample output]
0 30 15
【prompt】
Data for 30% n- , m <= 2000
To 100% of the data, n- , m <= 300000
Are read to ensure non-negative integer, all X <= 10000
【source】
Thank God for Ben
Thank God Ben
Ben very, very grateful to God