f and g
Time limit3sMemory limit512 MB
Compute g(T,k)=sum_{x=0}^{T} sum_i (x+a_i)^k mod 1e9+7 for every k from 0 to K, given N up to 1e5, K up to 5e4, T up to 1e18.
- Level
Hard10 of 10
- Topics
- Math, Combinatorics, Divide and conquer, Number theory
- Solved
- No attempts yet
Problem
You are given integers . Define functions and as follows.
[f(x,k) = (x + a_1)^k + (x + a_2)^k + \cdots + (x + a_N)^k]
[g(t,k) = f(0,k) + f(1,k) + \cdots + f(t,k)]
Given integers and , and the sequence , compute modulo for every integer such that .
Input
The first line contains three integers , , and .
The second line contains integers .
Output
Print modulo , separated by single spaces.