#Lutece1310. Dynamic Dynamic Programming
Dynamic Dynamic Programming
Migrated from Lutece 1310 Dynamic Dynamic Programming
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
There is a common formula of dynamic programming:
Now let's make it more dynamic. You will be given the for initially, then there are two types of query:
-
Change to .
-
Return the value of .
It is guaranteed that for all above.
Input
the first line contains two integers and : the length of the array and the number of queries.
There are integers in next line. The integer indicates .
Then lines is following, each with a query. There are two types of query:
1 j v
: Change to .
2 i j
: Return the value of .
Output
For each query 2 i j
, output the answer in one line. As the answer may be too large, output it modulo (i.e. if the answer is , you should output ).
Samples
3 4
1 2 3
2 1 2
2 2 3
1 1 2
2 2 3
3
10
13
Resources
The 14th UESTC Programming Contest Final