아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Polynomial in a Black Box

시간 제한2초메모리 제한512 MB

요약
차수가 10 이하인 다항식을 10^9+7로 나눈 나머지를 블랙박스에 최대 d+3번 질의해 차수를 알아낸다.
난이도

보통10점 중 7점

유형
수학, 이분 탐색, 정수론
정답자
아직 제출이 없습니다

문제

This is an interactive problem.

Alice has a black box which works with integers modulo m=109+7m = 10^{9} + 7. If a user types a number xx on the keyboard of the box, the screen shows the number equal to the value of the polynomial p(x)=(a_dxd+a_d−1xd−1+…+a_1x1+a_0) mod mp (x) = (a\_{d} x^{d} + a\_{d - 1} x^{d - 1} + \ldots + a\_{1} x^{1} + a\_{0}) \bmod m. The degree dd of the polynomial is unknown, as are its coefficients a_ia\_{i}. It is only known that 0≤d≤100 \le d \le 10 and a_d≠0a\_d \ne 0.

Alice can type several numbers xx and learn the values of the polynomial for these numbers. Help her find the degree dd of the polynomial. She can input an xx at most d+3d + 3 times.

힌트

In each test, the degree and the coefficients of the polynomial p(x)p (x) are chosen and fixed in advance.

In the example, which is also the first test in the testing system, p(x)=x2+1,000,000,005p (x) = x^2 + 1\\,000\\,000\\,005. All other tests were created as follows: first, the degree dd was chosen (0≤d≤100 \le d \le 10), and after that, one of the polynomials of such degree was chosen as p(x)p (x) uniformly at random.

예제1

  1. 예제 1

    입력
    
    1000000006
    
    7
    
    34
    
    98
    
    
    예상 출력
    ask 1
    
    ask 3
    
    ask 6
    
    ask 10
    
    degree 2