Integral of Polynomial Functions and Queries
Time limit1sMemory limit1024 MB
Given values A_0 to A_N, answer 6 times the integral of the smooth piecewise polynomial g over [a, b] while point values are updated.
- Level
Medium7 of 10
- Topics
- Segment tree, Math, Prefix sum
- Solved
- No attempts yet
Problem
A sequence of length is given. Then polynomial functions and a function are determined by the following conditions.
- For every nonnegative integer with , .
- For every positive integer with , if , then .
- is differentiable on the interval .
- The sequence of degrees of , read in order, is as lexicographically early as possible.
Write a program that handles the following queries.
1 i v: Change to .2 a b: Print .
Input
The first line contains .
The second line contains integers , separated by spaces.
The third line contains the number of queries .
Each of the next lines contains one query.
Every input is guaranteed to contain at least one query of type 2.
All input numbers are integers.
Output
For each query of type 2, print the result on its own line, in order. The result of every type 2 query is always an integer, and this can be proven.