#P12179. DerrickLo's Game (UBC002B)
DerrickLo's Game (UBC002B)
Description
There is an array with numbers (). You have to handle modifications or queries (). There are two types of modifications or queries:
-
Input
1 k x, this changes into (, ) (modify). -
Input
2 l r, you have to print the minimum cost of making the same by the two operations below (This does not really changes the array.) () (query):
-
Choose an integer , increase by . This costs .
-
Choose an interval , change into . This costs .
Input Format
The first line contains two integers .
The second line contains integers, representing .
For the next lines, each line contains three integers, representing a modify or a query.
Output Format
Suppose there are queries. Please output lines, representing the answers for each one.
3 2
1 2 3
2 1 2
2 1 1
1
0
Hint
For the first query, we choose and increase it by . This costs . So output .
For the second query, we don't need to do any operations since the number in is already the same.
京公网安备 11011102002149号