Dirichlet -th root
Time limit1sMemory limit256 MB
Given g on 1..n over F_p with g(1)=1, find f with f(1)=1 such that the k-fold Dirichlet convolution of f equals g, or report no solution.
- Level
Hard9 of 10
- Topics
- Number theory, Math, Divide and conquer, Implementation
- Solved
- No attempts yet
Problem
Mathematician Pang learned Dirichlet convolution during the previous camp. However, compared with deep reinforcement learning, it was too easy for him. Therefore, he did something special.
If are two functions from the positive integers to the integers, the Dirichlet convolution is a new function defined by:
We define the -th power of a function by
In this problem, we want to solve the inverse problem: given and , you need to find a function such that .
Moreover, there is an additional constraint that and must equal . And all the arithmetic operations are done on where , which means that in the Dirichlet convolution, .
Input
The first line contains two integers and .
The second line contains n integers ().
Output
If there is no solution, output .
Otherwise, output (). If there are multiple solutions, print any of them.