#SGM0000058. Đứa trẻ và dãy số (The Child and Sequence)
Đứa trẻ và dãy số (The Child and Sequence)
The Child and Sequence
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
You are given an integer array . Process operations in order:
1 l r: print .2 l r x: for every , set .3 k x: set .
Input
The first line contains . The second line contains . Each of the next lines is one operation in one of the three formats above.
Output
For every type-1 operation, print the range sum on its own line.
Subtasks
-
Subtask 1 (20%): n,m≤30; all other conditions are unchanged.
-
Subtask 2 (30%): n,m≤3000; all other conditions are unchanged.
-
Subtask 3 (50%): full constraints:
-
-
-
-
indices are 1-based and every query range is inclusive
Examples
Input
5 5
1 2 3 4 5
2 3 5 4
3 3 5
1 2 5
2 1 3 3
1 1 3
Output
8
5
Explanation
After modulo on positions 3..5 by 4, [3,4,5] becomes [3,0,1]. Setting position 3 to 5 gives [1,2,5,0,1]; the sum on 2..5 is 8.