주어진 수열 뒤에 m개 항을 붙여, 완성된 수열을 가장 낮은 차수의 다항식으로 나타낼 수 있게 만든다.
어려움8수학정수론조합론구현아직 제출이 없습니다시간 제한4초메모리 제한256 MBFor sure you have seen puzzles like "Given the sequence, find its next element". They seem logical in your childhood, but later you begin to understand that you can write any number and justify it with some tricky construction.
In this problem you have to continue the sequence "in the easiest way". Still not strict enough? Let us give a formal definition.
Let the hardness of the sequence a_1,a_2,…,a_n be the minimum integer d such that there exists a polynomial p of degree d for which p(x)≡a_x(mod998,244,353) for all x from 1 to n. For this problem, consider the polynomial p(x)=0 to have degree −1.
Given a sequence a_1,a_2,...,a_n of size n, your task is to construct a sequence b_1,b_2,…,b_n+m of size n+m such that:
The first line of input contains two integers n and m (1≤n≤105, 1≤m≤8⋅105).
The second line of input contains n integers a_i: the initial sequence (0≤a_i<998,244,353).
Print m integers b_n+1,b_n+2,…,b_n+m separated by spaces.
The notation u≡v(modp) means that u and v have the same remainder modulo p.