Guess the Distribution

아직 제출이 없습니다시간 제한7초메모리 제한256 MB

문제

Let p(0;1)p \in (0;1) be a real number and n\[1;100]n \in \[1;100] be a positive integer. Consider ξ_1,ξ_2,,ξ_n\xi\_1, \xi\_2, \ldots, \xi\_n --- independent random variables such that P(ξ_i=1)=pP(\xi\_i = 1) = p and P(ξ_i=0)=1pP(\xi\_i = 0) = 1 - p. Consider the random variable \[\theta_n = \frac{\xi_1 + \ldots + \xi_n + u - np}{\sqrt{np(1-p)}}\text{,}\] where uu is a random variable which is uniformly distributed in \[12,12]\[-\frac{1}{2}, \frac{1}{2}] independently from all ξ_i\xi\_i.

You are given pp and a sample from the distribution θ_n\theta\_n for some nn. You need to determine nn.

입력

The first line of input contains one integer TT (T=30T = 30) --- the number of samples.

The second line contains a real number p(0;1)p \in (0; 1) with at most two digits after the decimal point.

Each of next TT lines contains the description of the sample. It consists of an integer NN (N=104N = 10^4) --- the size of the sample, and NN space-separated real numbers x_1,x_2,,x_Nx\_1, x\_2, \ldots, x\_N with at most 10 digits after decimal point, describing the sample of the distribution θ_n\theta\_n for some nn.

It is guaranteed that the test case is generated as follows: we choose pp and seed ss by hand and then choose all nn as TT random integers from \[1;100]\[1;100] using a pseudo-random number generator with initial seed ss.

In the sample test case T=2T = 2 and N=3N = 3 just to show the format.

출력

For each of TT samples print one integer on a separate line --- the number ans_i\[1;100]\mathit{ans}\_i \in \[1;100] which you think defines the distribution θ_n\theta\_n.

Your answer for the whole test case will be considered correct, if the average absolute error does not exceed 5, so that \[\frac{1}{T}\sum\limits_{i=1}^T |n_i - \mathit{ans}_i| \le 5\text{.}\]