Polynomial Equation
시간 제한1.5초메모리 제한1024 MB
체 F_p 위의 이변수 다항식 P와 차수 상한 d가 주어질 때, (P+S)(Q(x)-Q(y))=R(x)-R(y)를 만족하는 일변수 Q, R과 저차 다항식 S가 존재하는지 판정하고 존재하면 Q, R을 출력한다.
문제
Busy Beaver has a polynomial equation that he doesn't know how to solve, and he needs your help!
For a bivariate polynomial , define its degree . For example, . Furthermore, we take the degree of the zero polynomial to be .
Given a bivariate polynomial with integer coefficients and an integer , determine whether there exists a bivariate polynomial and non-constant univariate polynomials such that
- for , we have as polynomials in 1,
- .
If a solution exists, output any valid . Note that you do not need to output .
1i.e. when expanded, the two sides of the equation have equal coefficients modulo .
입력
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains two integers (, ) --- the value of and the upper bound on , respectively.
The -th of the next lines contains integers () --- the coefficients of so that . It is guaranteed that has degree , i.e. at least one of is nonzero.
It is guaranteed that the sum of across all test cases is no more than .
출력
The first line of output for each test case should contain the string "YES" (without quotes) if a solution exists, and "NO" (without quotes) otherwise.
If you claim that a solution exists, continue outputting the solution as follows:
The second line of output for each test case should contain three integers () --- the degrees of the polynomials respectively.
The third line of output for each test case should contain integers (, ) --- the coefficients of .
The fourth line of output for each test case should contain integers (, ) --- the coefficients of .
Note that you do not need to output --- the judge will determine if a suitable choice of exists for your claimed .
힌트
In the first test case, the given polynomial is We can take , , , which gives a valid solution.
In the second test case, it can be shown that no solution exists.