Polynomial in a Black Box
시간 제한2초메모리 제한512 MB
차수가 10 이하인 다항식을 10^9+7로 나눈 나머지를 블랙박스에 최대 d+3번 질의해 차수를 알아낸다.
문제
This is an interactive problem.
Alice has a black box which works with integers modulo . If a user types a number on the keyboard of the box, the screen shows the number equal to the value of the polynomial . The degree of the polynomial is unknown, as are its coefficients . It is only known that and .
Alice can type several numbers and learn the values of the polynomial for these numbers. Help her find the degree of the polynomial. She can input an at most times.
힌트
In each test, the degree and the coefficients of the polynomial are chosen and fixed in advance.
In the example, which is also the first test in the testing system, . All other tests were created as follows: first, the degree was chosen (), and after that, one of the polynomials of such degree was chosen as uniformly at random.